示例#1
0
 /**
  * Search the mixin method map and call the method or forward the call to each row
  *
  * This function implements a just in time mixin strategy. Available table behaviors are only mixed when needed.
  * Lazy mixing is triggered by calling DatabaseRowTable::is[Behaviorable]();
  *
  * @param  string     $method    The function name
  * @param  array      $arguments The function arguments
  * @return mixed The result of the function
  */
 public function __call($method, $arguments)
 {
     if ($this->isConnected() && !isset($this->_mixed_methods[$method])) {
         $parts = StringInflector::explode($method);
         //Check if a behavior is mixed
         if ($parts[0] == 'is' && isset($parts[1])) {
             //Lazy mix behaviors
             $behavior = strtolower($parts[1]);
             if ($this->getTable()->hasBehavior($behavior)) {
                 $this->mixin($this->getTable()->getBehavior($behavior));
             } else {
                 return false;
             }
         }
     }
     return parent::__call($method, $arguments);
 }
示例#2
0
 /**
  * Get the entity key
  *
  * @return string
  */
 public function getIdentityKey()
 {
     return parent::getIdentityColumn();
 }