diff --git a/src/ORM/Table.php b/src/ORM/Table.php index 0377052198e..c81653d789a 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -279,12 +279,8 @@ public function __construct(array $config = []) } } $this->_eventManager = $eventManager ?: new EventManager(); - if ($behaviors) { - $behaviors->setTable($this); - } else { - $behaviors = new BehaviorRegistry($this); - } - $this->_behaviors = $behaviors; + $this->_behaviors = $behaviors ?: new BehaviorRegistry(); + $this->_behaviors->setTable($this); $this->_associations = $associations ?: new AssociationCollection(); $this->initialize($config);