PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, February 21, 2022

[FIXED] cakephp3 afterSave callback error

 February 21, 2022     cakephp, cakephp-3.0     No comments   

Issue

Whenever a new entity is created, the following error occurs.

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 code inside the model

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

}

Anyone have any idea what's going on here?


Solution

I found the answer. Should be CakePHP documentation bug here. Hope it helps someone. Link here: http://book.cakephp.org/3.0/en/orm/table-objects.html#Cake\ORM\Table::afterSave

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


Answered By - Shawn Ang
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing