Cakephp 3 Callback method not reached

前端 未结 2 1356
遇见更好的自我
遇见更好的自我 2021-01-26 20:24

I have a problem with the afterDelete callback method. I can\'t use them.

Inside one of my \"Storages\" plugin controllers I want to delete a record and after that I wan

相关标签:
2条回答
  • 2021-01-26 21:15

    As can be seen in the debugging results, $this->StoragecontainerBlockElements is not what you thought it is, it is a so called "auto-table" or "generic table", that is, an instance of \Cake\ORM\Table instead of a concrete subclass thereof.

    Your StoragecontainerBlockElementsTable class/file cannot be found/loaded for some reason, hence the fallback to \Cake\ORM\Table. Might be caused by

    • a typo in the filename, classname, or the namespace
    • or the namespace is missing completely (it's not in your question)
    • or the class lives in a plugin, and you didn't used plugin notation for loading it
    • or the file permissions do not allow reading file
    • or the file is missing (not deployed)
    • ...

    See also

    • Cookbook > Configuration > Disabling Generic Tables
    0 讨论(0)
  • 2021-01-26 21:28

    Try

    use Cake\Log\Log;
    use Cake\ORM\Table;
    
    class StoragecontainerBlockElementsTable extends Table {
    
        public function afterDelete($event, $entity, $options){
            Log::debug('Got here');
    
        }
    }
    

    Details Here

    0 讨论(0)
提交回复
热议问题