/**
  * @expectedException RuntimeException
  */
 public function testCannotAttachBehaviorToAnythingButActiveRecord()
 {
     $model = new Model();
     $model->attachBehavior('saveRelated', SaveRelationsBehavior::className());
 }
Example #2
0
 /**
  * @inheritdoc
  *
  * Additionally, tracks attached behaviors to allow iterating over them.
  */
 public function attachBehavior($name, $behavior)
 {
     $this->_behaviors[$name] = $name;
     unset(self::$_names[get_class($this)]);
     return parent::attachBehavior($name, $behavior);
 }