public function addBehavior($bdata)
    {
        if ($bdata instanceof Behavior) {
            $behavior = $bdata;
            $behavior->setDatabase($this);
            $this->behaviors[$behavior->getName()] = $behavior;

            return $behavior;
        } else {
            $class = $this->getConfiguredBehavior($bdata['name']);
            $behavior = new $class();
            $behavior->loadFromXML($bdata);

            return $this->addBehavior($behavior);
        }
    }
public function addBehavior($bdata)
    {
        if ($bdata instanceof Behavior) {
            $behavior = $bdata;
            $behavior->setDatabase($this);
            $this->behaviors[$behavior->getName()] = $behavior;

            return $behavior;
        } else {
            $class = $this->getConfiguredBehavior($bdata['name']);
            $behavior = new $class();
            $behavior->loadFromXML($bdata);

            return $this->addBehavior($behavior);
        }
    }
public function addBehavior ( $ bdata ) { if ( $ bdata instanceof Behavior ) { $ behavior = $ bdata ; $ behavior -> setDatabase ( $ this ) ; $ this -> behaviors [ $ behavior -> getName ( ) ] = $ behavior ; return $ behavior ; } else { $ class = $ this -> getConfiguredBehavior ( $ bdata [ 'name' ] ) ; $ behavior = new $ class ( ) ; $ behavior -> loadFromXML ( $ bdata ) ; return $ this -> addBehavior ( $ behavior ) ; } }
Adds a new Behavior to the database

@return Behavior A behavior instance
Adds a new Behavior to the database