{"action":"created","issue":{"url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/122","repository_url":"https://api.github.com/repos/burzum/cakephp-file-storage","labels_url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/122/comments","events_url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/122/events","html_url":"https://github.com/burzum/cakephp-file-storage/issues/122","id":135156146,"number":122,"title":"\"First arg must be a non empty string!\" exception when deleting on cascade","user":{"login":"choma","id":4775453,"avatar_url":"https://avatars.githubusercontent.com/u/4775453?v=3","gravatar_id":"","url":"https://api.github.com/users/choma","html_url":"https://github.com/choma","followers_url":"https://api.github.com/users/choma/followers","following_url":"https://api.github.com/users/choma/following{/other_user}","gists_url":"https://api.github.com/users/choma/gists{/gist_id}","starred_url":"https://api.github.com/users/choma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choma/subscriptions","organizations_url":"https://api.github.com/users/choma/orgs","repos_url":"https://api.github.com/users/choma/repos","events_url":"https://api.github.com/users/choma/events{/privacy}","received_events_url":"https://api.github.com/users/choma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/burzum/cakephp-file-storage/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"burzum","id":162789,"avatar_url":"https://avatars.githubusercontent.com/u/162789?v=3","gravatar_id":"","url":"https://api.github.com/users/burzum","html_url":"https://github.com/burzum","followers_url":"https://api.github.com/users/burzum/followers","following_url":"https://api.github.com/users/burzum/following{/other_user}","gists_url":"https://api.github.com/users/burzum/gists{/gist_id}","starred_url":"https://api.github.com/users/burzum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burzum/subscriptions","organizations_url":"https://api.github.com/users/burzum/orgs","repos_url":"https://api.github.com/users/burzum/repos","events_url":"https://api.github.com/users/burzum/events{/privacy}","received_events_url":"https://api.github.com/users/burzum/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/burzum/cakephp-file-storage/milestones/3","html_url":"https://github.com/burzum/cakephp-file-storage/milestones/1.1.0","labels_url":"https://api.github.com/repos/burzum/cakephp-file-storage/milestones/3/labels","id":1165880,"number":3,"title":"1.1.0","description":"- [ ] Remove the StorageManager from the plugin and use https://github.com/burzum/storage as dependency to prepare support for Gaufrette and Flysystem. See https://github.com/burzum/cakephp-file-storage/issues/56","creator":{"login":"burzum","id":162789,"avatar_url":"https://avatars.githubusercontent.com/u/162789?v=3","gravatar_id":"","url":"https://api.github.com/users/burzum","html_url":"https://github.com/burzum","followers_url":"https://api.github.com/users/burzum/followers","following_url":"https://api.github.com/users/burzum/following{/other_user}","gists_url":"https://api.github.com/users/burzum/gists{/gist_id}","starred_url":"https://api.github.com/users/burzum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burzum/subscriptions","organizations_url":"https://api.github.com/users/burzum/orgs","repos_url":"https://api.github.com/users/burzum/repos","events_url":"https://api.github.com/users/burzum/events{/privacy}","received_events_url":"https://api.github.com/users/burzum/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":12,"state":"open","created_at":"2015-06-15T23:03:39Z","updated_at":"2016-02-28T23:32:00Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-02-21T03:59:08Z","updated_at":"2016-02-29T08:31:20Z","closed_at":"2016-02-28T23:32:00Z","body":"I'm having a \"First arg must be a non empty string!\" exception when trying to delete a post and its associated image on cascade.\r\n\r\nI'm using cakephp v3.2.1, with cakephp-file-storage v1.1.4 and cakephp-imagine-plugin v2.1.1\r\n\r\nAs I understand the problem is [here](https://github.com/burzum/cakephp-file-storage/blob/1.1/src/Storage/Listener/AbstractListener.php#L390). It is trying to read `$event->result['adapter']`, but `$event->result` is equal to `true` (I'm not sure, but I think that value comes from [here](https://github.com/burzum/cakephp-file-storage/blob/2205d0ccdc85a6a71862809adc25f3a6445bc5d6/src/Model/Table/ImageStorageTable.php#L130))\r\n\r\nHere is my current configuration:\r\n``` php\r\n// config/file_storage.php\r\n$listener = new BaseListener([\r\n\t'imageProcessing' => true, // Required if you want image processing!\r\n\t'pathBuilderOptions' => [\r\n\t\t'pathPrefix' => '/files',\r\n\t\t'preserveFilename' => true\r\n\t]\r\n]);\r\n// Attach the BaseListener to the global EventManager\r\nEventManager::instance()->on($listener);\r\nConfigure::write('FileStorage', [\r\n\t// Configure image versions on a per model base\r\n        // Same as docs example\r\n]);\r\n// This is very important! The hashes are needed to calculate the image versions!\r\nStorageUtils::generateHashes();\r\n// Configure Local adapter instance through the StorageManager\r\nStorageManager::config('Local', [\r\n\t'adapterOptions' => [ROOT . DS . 'file_storage', true],\r\n\t'adapterClass' => '\\Gaufrette\\Adapter\\Local',\r\n\t'class' => '\\Gaufrette\\Filesystem'\r\n]);\r\n// Set model field\r\n\\Cake\\Event\\EventManager::instance()->on('Model.beforeSave', function (\\Cake\\Event\\Event $event, \\Cake\\ORM\\Entity $entity, ArrayObject $options) {\r\n\t$event->subject()->patchEntity($entity, ['model' => $entity->source()]);\r\n});\r\n```\r\nTable classes:\r\n``` php\r\nclass PostsTable extends Table\r\n{\r\n\tpublic function initialize(array $config)\r\n\t{\r\n        parent::initialize($config);\r\n\t\t$this->hasOne('MainImages', [\r\n\t\t\t'foreignKey' => 'foreign_key',\r\n\t\t\t'className' => 'PostImages',\r\n\t\t\t'conditions' => ['model' => 'MainImages'],\r\n\t\t\t'dependent' => true,\r\n\t\t\t'cascadeCallbacks' => true\r\n\t\t]);\r\n\t}\r\n}\r\n```\r\nand\r\n``` php\r\nuse Burzum\\FileStorage\\Model\\Table\\ImageStorageTable;\r\nclass PostImagesTable extends ImageStorageTable\r\n{\r\n    // empty\r\n}\r\n```\r\n\r\nThe controllers and templates are baked, and I'm using the posts/delete action to delete posts (and images on cascade).\r\n\r\nHere is the full error log message:\r\n```\r\n2016-02-21 03:16:43 Error: [Burzum\\FileStorage\\Storage\\StorageException] First arg must be a non empty string!\r\nRequest URL: /posts/delete/32\r\nReferer URL: http://testupload.v1/posts\r\nStack Trace:\r\n#0 /home/choma/www/testupload_v1/vendor/burzum/file-storage/src/Storage/Listener/BaseListener.php(81): Burzum\\FileStorage\\Storage\\Listener\\AbstractListener->_deleteFile(Object(Cake\\Event\\Event))\r\n#1 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Burzum\\FileStorage\\Storage\\Listener\\BaseListener->afterDelete(Object(Cake\\Event\\Event), Object(Cake\\ORM\\Entity), Object(Gaufrette\\Filesystem), Object(App\\Model\\Table\\PostImagesTable))\r\n#2 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventManager.php(355): Cake\\Event\\EventManager->_callListener(Array, Object(Cake\\Event\\Event))\r\n#3 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\\Event\\EventManager->dispatch(Object(Cake\\Event\\Event))\r\n#4 /home/choma/www/testupload_v1/vendor/burzum/file-storage/src/Model/Table/FileStorageTable.php(243): Cake\\ORM\\Table->dispatchEvent('ImageStorage.af...', Array, NULL)\r\n#5 /home/choma/www/testupload_v1/vendor/burzum/file-storage/src/Model/Table/ImageStorageTable.php(129): Burzum\\FileStorage\\Model\\Table\\FileStorageTable->dispatchEvent('ImageStorage.af...', Array)\r\n#6 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Burzum\\FileStorage\\Model\\Table\\ImageStorageTable->afterDelete(Object(Cake\\Event\\Event), Object(Cake\\ORM\\Entity), Object(ArrayObject), Object(App\\Model\\Table\\PostImagesTable))\r\n#7 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventManager.php(355): Cake\\Event\\EventManager->_callListener(Array, Object(Cake\\Event\\Event))\r\n#8 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\\Event\\EventManager->dispatch(Object(Cake\\Event\\Event))\r\n#9 /home/choma/www/testupload_v1/vendor/burzum/file-storage/src/Model/Table/FileStorageTable.php(243): Cake\\ORM\\Table->dispatchEvent('Model.afterDele...', Array, NULL)\r\n#10 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1725): Burzum\\FileStorage\\Model\\Table\\FileStorageTable->dispatchEvent('Model.afterDele...', Array)\r\n#11 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1647): Cake\\ORM\\Table->_processDelete(Object(Cake\\ORM\\Entity), Object(ArrayObject))\r\n#12 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Database/Connection.php(557): Cake\\ORM\\Table->Cake\\ORM\\{closure}(Object(Cake\\Database\\Connection))\r\n#13 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1652): Cake\\Database\\Connection->transactional(Object(Closure))\r\n#14 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Association/DependentDeleteTrait.php(48): Cake\\ORM\\Table->delete(Object(Cake\\ORM\\Entity), Array)\r\n#15 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php(270): Cake\\ORM\\Association\\HasOne->cascadeDelete(Object(App\\Model\\Entity\\Post), Array)\r\n#16 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1709): Cake\\ORM\\AssociationCollection->cascadeDelete(Object(App\\Model\\Entity\\Post), Array)\r\n#17 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1647): Cake\\ORM\\Table->_processDelete(Object(App\\Model\\Entity\\Post), Object(ArrayObject))\r\n#18 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Database/Connection.php(557): Cake\\ORM\\Table->Cake\\ORM\\{closure}(Object(Cake\\Database\\Connection))\r\n#19 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/ORM/Table.php(1652): Cake\\Database\\Connection->transactional(Object(Closure))\r\n#20 /home/choma/www/testupload_v1/src/Controller/PostsController.php(102): Cake\\ORM\\Table->delete(Object(App\\Model\\Entity\\Post))\r\n#21 [internal function]: App\\Controller\\PostsController->delete('32')\r\n#22 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Controller/Controller.php(430): call_user_func_array(Array, Array)\r\n#23 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(114): Cake\\Controller\\Controller->invokeAction()\r\n#24 /home/choma/www/testupload_v1/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(87): Cake\\Routing\\Dispatcher->_invoke(Object(App\\Controller\\PostsController))\r\n#25 /home/choma/www/testupload_v1/webroot/index.php(37): Cake\\Routing\\Dispatcher->dispatch(Object(Cake\\Network\\Request), Object(Cake\\Network\\Response))\r\n#26 {main}\r\n```"},"comment":{"url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/comments/190099771","html_url":"https://github.com/burzum/cakephp-file-storage/issues/122#issuecomment-190099771","issue_url":"https://api.github.com/repos/burzum/cakephp-file-storage/issues/122","id":190099771,"user":{"login":"burzum","id":162789,"avatar_url":"https://avatars.githubusercontent.com/u/162789?v=3","gravatar_id":"","url":"https://api.github.com/users/burzum","html_url":"https://github.com/burzum","followers_url":"https://api.github.com/users/burzum/followers","following_url":"https://api.github.com/users/burzum/following{/other_user}","gists_url":"https://api.github.com/users/burzum/gists{/gist_id}","starred_url":"https://api.github.com/users/burzum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burzum/subscriptions","organizations_url":"https://api.github.com/users/burzum/orgs","repos_url":"https://api.github.com/users/burzum/repos","events_url":"https://api.github.com/users/burzum/events{/privacy}","received_events_url":"https://api.github.com/users/burzum/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T08:31:20Z","updated_at":"2016-02-29T08:31:20Z","body":"No problem, I've made the change.\r\n\r\nAny reason you didn't do the change yourself and created a pull request?"}}