/** * Command handler * * @param CommandInterface $command The command * @param CommandChainInterface $chain The chain executing the command * @return array|mixed Returns an array of the handler results in FIFO order. If a handler returns not NULL and the * returned value equals the break condition of the chain the break condition will be returned. */ public function execute(CommandInterface $command, CommandChainInterface $chain) { if ($command->data instanceof DatabaseRowInterface) { $this->setMixer($command->data); } return parent::execute($command, $chain); }
/** * Command handler * * This function translates 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 $name The command name * @param CommandContext $context The command context * @return boolean Can return both true or false. */ public function execute($name, CommandContext $context) { if ($context->data instanceof DatabaseRowInterface) { $this->setMixer($context->data); } return parent::execute($name, $context); }
/** * Command handler * * This function translates the command name that starts with 'action' to a command handler function of the format * '_action[Action]' * * @param string $name The command name * @param CommandContext $context The command context * @return boolean Can return both true or false. */ public function execute($name, CommandContext $context) { $this->setMixer($context->getSubject()); $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); }