イベントのディスパッチ処理を簡素化する。 イベント名は命名規則にしたがって決定される。 Layer.Plugin.Class.eventName 登録されたイベントリスナーが存在しない場合には、falseを を返す。 存在する場合には、生成された CakeEvent を返す。
Inheritance: extends Object
Example #1
0
 /**
  * イベントを発火
  * 
  * @param string $name
  * @param array $params
  * @return mixed
  */
 public function dispatchEvent($name, $params = array(), $options = array())
 {
     $options = array_merge(array('modParams' => 0, 'plugin' => $this->plugin, 'layer' => 'Model', 'class' => $this->name), $options);
     App::uses('BcEventDispatcher', 'Event');
     return BcEventDispatcher::dispatch($name, $this, $params, $options);
 }
Example #2
0
 /**
  * イベントを発火
  * 
  * @param string $name
  * @param array $params
  * @return mixed
  */
 public function dispatchEvent($name, $params = array(), $options = array())
 {
     $options = array_merge(array('modParams' => 0, 'plugin' => $this->plugin, 'layer' => 'Helper', 'class' => str_replace('Helper', '', get_class($this))), $options);
     App::uses('BcEventDispatcher', 'Event');
     return BcEventDispatcher::dispatch($name, $this->_View, $params, $options);
 }
Example #3
0
 /**
  * イベントを発火
  * 
  * @param string $name
  * @param array $params
  * @return mixed
  */
 public function dispatchEvent($name, $params = array(), $options = array())
 {
     // CakeEmailより呼び出される場合、AppViewを直接呼び出す為、$this->nameに値が入らない。
     // その際、View.beforeRenderをループで呼び出してしまうので、イベントを実行しない。
     if (!$this->name) {
         return false;
     }
     $options = array_merge(array('modParams' => 0, 'plugin' => $this->plugin, 'layer' => 'View', 'class' => $this->name), $options);
     App::uses('BcEventDispatcher', 'Event');
     return BcEventDispatcher::dispatch($name, $this, $params, $options);
 }