Skip to content

Commit

Permalink
Revert "Fix up behavior callbacks for clean inheritance and consisten…
Browse files Browse the repository at this point in the history
…cy."

This reverts commit 9e93097.

Changing argument typehints is not backwards compatible and causes errors when these
methods are overridden in extending classes.
  • Loading branch information
ADmad committed Apr 25, 2018
1 parent 9aa5065 commit 7cddf08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/ORM/Behavior/CounterCacheBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\ORM\Behavior;

use ArrayObject;
use Cake\Datasource\EntityInterface;
use Cake\Event\Event;
use Cake\ORM\Association;
Expand Down Expand Up @@ -119,7 +118,7 @@ class CounterCacheBehavior extends Behavior
* @param \ArrayObject $options The options for the query
* @return void
*/
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)
public function beforeSave(Event $event, EntityInterface $entity, $options)
{
if (isset($options['ignoreCounterCache']) && $options['ignoreCounterCache'] === true) {
return;
Expand Down Expand Up @@ -156,7 +155,7 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
* @param \ArrayObject $options The options for the query
* @return void
*/
public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options)
public function afterSave(Event $event, EntityInterface $entity, $options)
{
if (isset($options['ignoreCounterCache']) && $options['ignoreCounterCache'] === true) {
return;
Expand All @@ -176,7 +175,7 @@ public function afterSave(Event $event, EntityInterface $entity, ArrayObject $op
* @param \ArrayObject $options The options for the query
* @return void
*/
public function afterDelete(Event $event, EntityInterface $entity, ArrayObject $options)
public function afterDelete(Event $event, EntityInterface $entity, $options)
{
if (isset($options['ignoreCounterCache']) && $options['ignoreCounterCache'] === true) {
return;
Expand Down
5 changes: 2 additions & 3 deletions src/ORM/Behavior/TranslateBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function setupFieldAssociations($fields, $table, $model, $strategy)
* @param \ArrayObject $options The options for the query
* @return void
*/
public function beforeFind(Event $event, Query $query, ArrayObject $options)
public function beforeFind(Event $event, Query $query, $options)
{
$locale = $this->getLocale();

Expand Down Expand Up @@ -364,10 +364,9 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
*
* @param \Cake\Event\Event $event The beforeSave event that was fired
* @param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved
* @param \ArrayObject $options Options.
* @return void
*/
public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options)
public function afterSave(Event $event, EntityInterface $entity)
{
$entity->unsetProperty('_i18n');
}
Expand Down
10 changes: 3 additions & 7 deletions src/ORM/Behavior/TreeBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\ORM\Behavior;

use ArrayObject;
use Cake\Database\Expression\IdentifierExpression;
use Cake\Datasource\EntityInterface;
use Cake\Datasource\Exception\RecordNotFoundException;
Expand Down Expand Up @@ -92,11 +91,10 @@ public function initialize(array $config)
*
* @param \Cake\Event\Event $event The beforeSave event that was fired
* @param \Cake\Datasource\EntityInterface $entity the entity that is going to be saved
* @param \ArrayObject $options Options.
* @return void
* @throws \RuntimeException if the parent to set for the node is invalid
*/
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)
public function beforeSave(Event $event, EntityInterface $entity)
{
$isNew = $entity->isNew();
$config = $this->getConfig();
Expand Down Expand Up @@ -162,10 +160,9 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
*
* @param \Cake\Event\Event $event The afterSave event that was fired
* @param \Cake\Datasource\EntityInterface $entity the entity that is going to be saved
* @param \ArrayObject $options Options.
* @return void
*/
public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options)
public function afterSave(Event $event, EntityInterface $entity)
{
if (!$this->_config['level'] || $entity->isNew()) {
return;
Expand Down Expand Up @@ -216,10 +213,9 @@ protected function _setChildrenLevel($entity)
*
* @param \Cake\Event\Event $event The beforeDelete event that was fired
* @param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved
* @param \ArrayObject $options Options.
* @return void
*/
public function beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)
public function beforeDelete(Event $event, EntityInterface $entity)
{
$config = $this->getConfig();
$this->_ensureFields($entity);
Expand Down

0 comments on commit 7cddf08

Please sign in to comment.