Ejemplo n.º 1
0
 /**
  * Command handler
  *
  * @param KCommandInterface         $command    The command
  * @param KCommandChainInterface    $chain      The chain executing the command
  * @return mixed If a handler breaks, returns the break condition. Returns the result of the handler otherwise.
  */
 public function execute(KCommandInterface $command, KCommandChainInterface $chain)
 {
     $parts = explode('.', $command->getName());
     $method = '_' . $parts[0] . ucfirst($parts[1]);
     if ($parts[0] == 'action') {
         $result = $this->{$method}($command);
     } else {
         $result = parent::execute($command, $chain);
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Command handler
  * 
  * This function transmlated the command name to a command handler function of 
  * the format '_before[Command]' or '_after[Command]. Command handler
  * functions should be declared protected.
  * 
  * @param 	string  	The command name
  * @param 	object   	The command context
  * @return 	boolean		Can return both true or false.  
  */
 public function execute($name, KCommandContext $context)
 {
     $this->setMixer($context->caller);
     $parts = explode('.', $name);
     if ($parts[0] == 'action') {
         $method = '_action' . ucfirst($parts[1]);
         if (method_exists($this, $method)) {
             return $this->{$method}($context);
         }
     }
     return parent::execute($name, $context);
 }
Ejemplo n.º 3
0
 /**
  * Get the methods that are available for mixin based
  *
  * @param  array           $exclude     An array of public methods to be exclude
  * @return array An array of methods
  */
 public function getMixableMethods($exclude = array())
 {
     $exclude = array_merge($exclude, array('authenticateRequest', 'signResponse'));
     return parent::getMixableMethods($exclude);
 }
Ejemplo n.º 4
0
 /**
  * Get the methods that are available for mixin based
  *
  * @param  array $exclude   A list of methods to exclude
  * @return array  An array of methods
  */
 public function getMixableMethods($exclude = array())
 {
     $exclude = array_merge($exclude, array('getInstance', 'save', 'delete'));
     return parent::getMixableMethods($exclude);
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getMixableMethods(KObject $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     return array_diff($methods, array('getRepository'));
 }
Ejemplo n.º 6
0
 protected function _initialize(KObjectConfig $config)
 {
     $config->append(array('container' => sprintf('%s-attachments', $config->mixer->getIdentifier()->getPackage())));
     parent::_initialize($config);
 }
Ejemplo n.º 7
0
 /**
  * Get the methods that are available for mixin based 
  * 
  * This function also dynamically adds a function of format is[Behavior] to allow client code to check if the
  * behavior is callable.
  * 
  * @param object The mixer requesting the mixable methods. 
  * @return array An array of methods
  */
 public function getMixableMethods(KObject $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     return array_diff($methods, array('save', 'delete'));
 }