1

每当创建新实体时,都会发生以下错误。

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]

afterSave 模型内的代码

public function afterSave(Event $event, Entity $entity, array $options) {

}

有人知道这里发生了什么吗?

4

2 回答 2

1

我找到了答案。应该是 CakePHP 文档的 bug。希望它可以帮助某人。链接在这里:http ://book.cakephp.org/3.0/en/orm/table-objects.html#Cake\ORM\Table::afterSave

public function afterSave(Event $event, Entity $entity, $options) {
}
于 2014-08-31T05:47:05.233 回答
0

添加这一行use ArrayObject;

于 2016-01-16T01:52:46.693 回答