Cake\ORM\Table::behaviors PHP Method

behaviors() public method

Returns the behavior registry for this table.
public behaviors ( ) : Cake\ORM\BehaviorRegistry
return Cake\ORM\BehaviorRegistry The BehaviorRegistry instance.
    public function behaviors()
    {
        return $this->_behaviors;
    }

Usage Example

 public function testStiTable()
 {
     $this->table->behaviors()->get('StiParent')->config('tableMap', ['Readers' => 'reader_*'], false);
     $this->table->behaviors()->get('StiParent')->config('discriminatorMap', ['*author' => TableRegistry::get('Authors')], false);
     $map = ['reader_1' => 'Readers', 'reader_2' => 'Readers', 'super_author' => 'Authors', 'bestselling-author' => 'Authors', 'other' => 'Users', '' => 'Users'];
     foreach ($map as $discriminator => $alias) {
         $entity = $this->table->newEntity(['discriminator' => $discriminator]);
         $table = $this->table->stiTable($entity);
         $this->assertEquals($alias, $table->alias());
     }
 }
All Usage Examples Of Cake\ORM\Table::behaviors