Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.86 KB

Migrating-from-CakePHP-2.md

File metadata and controls

24 lines (18 loc) · 1.86 KB

Migrating from CakePHP 2

Here is a list of things that have changed:

  • The plugin doesn't any longer use the configuration namespace Media but instead uses now the more appropriate namespace FileStorage.
  • The plugin is not using the CakeDC Migrations plugin any more but the official CakePHP Migrations plugin.
  • Lib\Utility\StorageUtils has been moved to Storage\StorageUtils.
  • FileStorageTable::fileExtension() has been removed, use pathinfo($path, PATHINFO_EXTENSION) instead.
  • FileStorageTable::stripUuid() has been removed, use events to handle the file saving and AbstractStorageEventListener::stripDashes().
  • FileStorageTable::tmpFile() has been removed, use events to handle the file saving and AbstractStorageEventListener::createTmpFile().
  • FileStorageTable::tmpFile() has been moved to AbstractStorageEventListener::fsPath(), use events to handle the file saving.
  • ImageStorageTable::hashOperations() has been removed, use StorageUtils::hashOperations().
  • ImageStorageTable::generateHashes() has been removed, use StorageUtils::generateHashes().
  • ImageStorageTable::ksortRecursive() has been removed, use StorageUtils::ksortRecursive().
  • Former UploadValidatorBehavior::uploadArray() has been moved to StorageUtils::uploadArray().
  • ImageHelper has been renamed to LegacyImageHelper and been replaced by a much more simpler implementation.

Image Helper Changes

The only purpose of the image helper was to generate the versions for the images on the fly depending on your config. This logic behind that was pretty complex and if stored right, there is no need to re-build the whole path.

The new implementation just adds the hash to the path, it doesn't do anything more or cares about the adapter or pathbuilders.

The old implementation is still accessible through the LegacyImageHelper.