/** * Add a behavior. * * Adds a behavior to this table's behavior collection. Behaviors * provide an easy way to create horizontally re-usable features * that can provide trait like functionality, and allow for events * to be listened to. * * Example: * * Load a behavior, with some settings. * * ``` * $this->addBehavior('Tree', ['parent' => 'parentId']); * ``` * * Behaviors are generally loaded during Table::initialize(). * * @param string $name The name of the behavior. Can be a short class reference. * @param array $options The options for the behavior to use. * @return void * @throws \RuntimeException If a behavior is being reloaded. * @see \Cake\ORM\Behavior */ public function addBehavior($name, array $options = []) { $this->_behaviors->load($name, $options); }