当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::trigger方法代码示例

本文整理汇总了PHP中yii\base\Component::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::trigger方法的具体用法?PHP Component::trigger怎么用?PHP Component::trigger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Component的用法示例。


在下文中一共展示了Component::trigger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: triggerComponentEvent

 public function triggerComponentEvent($name, Event $event, Component $component)
 {
     if ($component === null) {
         return;
     }
     $component->trigger($name, $event);
 }
开发者ID:entityfx,项目名称:yii2-utils,代码行数:7,代码来源:ComponentBase.php

示例2: trigger

 /**
  * @param string $name
  * @param Event $event
  */
 public function trigger($name, Event $event = null)
 {
     parent::trigger($name, $event);
     foreach ($this->_container as $model) {
         /** @var EmbeddedDocument $model */
         $model->trigger($name, $event);
     }
 }
开发者ID:ske,项目名称:yii2-mongodb-embedded,代码行数:12,代码来源:Storage.php

示例3: fire

 /**
  * 
  * @param string|Event $event
  * @param array $params
  */
 public function fire($event)
 {
     $params = func_get_args();
     array_shift($params);
     if (is_string($event)) {
         $name = $event;
         $event = new Event($name, $params);
     } else {
         $name = $event->name;
         if ($event instanceof Event) {
             $event->params = $params;
         }
     }
     if (!in_array($name, $this->_eventStates) && ($this->maxLevel === 0 || count($this->_eventStates) < $this->maxLevel)) {
         array_push($this->_eventStates, $name);
         parent::trigger($name, $event);
         array_pop($this->_eventStates);
     }
 }
开发者ID:sangkilsoft,项目名称:sangkilbiz-3,代码行数:24,代码来源:Hooks.php

示例4: trigger

 /**
  * Triggers a plugin event.
  * This method override locates all plugins within [[group]] and automatically allows each plugin to register
  * itself as event handler in this manager.
  * 
  * If a plugin implements [[PluginInterface]] the [[PluginInterface::register()]] method is called allowing the
  * plugin to register itself as event handler in the plugin manager (or any other subclass of [[Component]]).
  *
  * Usage:
  *
  * ~~~php
  * Yii::$app->big->pluginManager->setFolder('@app/plugins')->setGroup('users')->trigger('user.saved');
  * ~~~
  *
  * @param string $name the event name.
  * @param Event $event the event parameter. If not set, a default [[Event]] object will be created.
  * @throws yii\base\InvalidConfigException if [[group]] or [[pluginsFolder]] is not set in this manager.
  */
 public function trigger($name, Event $event = null)
 {
     if (!$this->pluginsFolder) {
         throw new InvalidConfigException('The property "$pluginsFolder" must be set in ' . get_class($this) . '.');
     } elseif (!$this->group) {
         throw new InvalidConfigException('The property "$group" must be set in ' . get_class($this) . '.');
     }
     $this->activateGroup($this->group);
     parent::trigger($name, $event);
 }
开发者ID:bigbrush,项目名称:yii2-big,代码行数:28,代码来源:PluginManager.php


注:本文中的yii\base\Component::trigger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。