Exemplo n.º 1
0
 /**
  * Get the methods that are available for mixin based
  *
  * This function also dynamically adds a function of format _action[Action]
  *
  * @param ObjectMixable $mixer The mixer requesting the mixable methods.
  * @return array An array of methods
  */
 public function getMixableMethods(ObjectMixable $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     foreach ($this->getMethods() as $method) {
         if (substr($method, 0, 7) == '_action') {
             $methods[strtolower(substr($method, 7))] = strtolower(substr($method, 7));
         }
     }
     return $methods;
 }
Exemplo n.º 2
0
 /**
  * Execute a mixed controller action by it's name
  *
  * If the method is an action defined by the behavior call _action[Method]
  *
  * @param  string  $method Method name
  * @param  array   $args   Array containing all the arguments for the original call
  * @return mixed
  * @see execute()
  */
 public function __call($method, $args)
 {
     //Handle action alias method
     if (in_array($method, $this->__actions)) {
         if (isset($args[0]) && $args[0] instanceof CommandInterface) {
             $method = '_action' . ucfirst($method);
             return $this->{$method}($args[0]);
         }
     }
     return parent::__call($method, $args);
 }
Exemplo n.º 3
0
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   ObjectConfig $config  An optional ObjectConfig object with configuration options
  * @return  void
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('priority' => self::PRIORITY_LOWEST, 'event_publisher' => 'event.publisher', 'event_immutable' => true));
     parent::_initialize($config);
 }
Exemplo n.º 4
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 ObjectInterface The mixer requesting the mixable methods.
  * @return array An array of methods
  */
 public function getMixableMethods(ObjectMixable $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     unset($methods['save']);
     unset($methods['delete']);
     unset($methods['getInstance']);
     return $methods;
 }
Exemplo n.º 5
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);
 }