每当创建新实体时,都会发生以下错误。
Warning (4096): Argument 3 passed to App\Model\Table\AccountsTable::afterSave() must be of the type array, object given, called in D:\Xampp\htdocs\vendor\cakephp\cakephp\src\Event\EventManager.php on line 268 and defined [APP/Model\Table\AccountsTable.php, line 18]
在模型中保存代码
public function afterSave(Event $event, Entity $entity, array $options) {
}
任何人都知道这里发生了什么?
答案 0 :(得分:1)
我找到了答案。这里应该是CakePHP文档错误。希望它可以帮助某人。点击此处:http://book.cakephp.org/3.0/en/orm/table-objects.html#Cake\ORM\Table::afterSave
public function afterSave(Event $event, Entity $entity, $options) {
}
答案 1 :(得分:0)
添加此行use ArrayObject;