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


PHP base\Component类代码示例

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


在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: validate

 /**
  * @param Component $component
  * @return \skeeks\sx\validate\Result
  */
 public function validate($component)
 {
     if (!$component instanceof ActiveRecord) {
         return $this->_bad(\Yii::t('app', "Object: {class} must be inherited from: {parent}", ['class' => $component->className(), 'parent' => ActiveRecord::className()]));
     }
     return !$component->isNewRecord ? $this->_ok() : $this->_bad(\Yii::t('app', "The object must already be saved"));
 }
开发者ID:Liv1020,项目名称:cms,代码行数:11,代码来源:NotNewRecord.php

示例3: behavior

 /**
  * Getting behavior object from given model
  *
  * @param Component $model
  * @return SeoBehavior
  * @throws InvalidConfigException if model don't have our SeoBehavior
  */
 protected static function behavior(Component $model)
 {
     foreach ($model->getBehaviors() as $b) {
         if ($b instanceof SeoBehavior) {
             return $b;
         }
     }
     throw new InvalidConfigException('Model ' . $model->className() . ' must have SeoBehavior');
 }
开发者ID:romi45,项目名称:yii2-seo-behavior,代码行数:16,代码来源:SeoContentHelper.php

示例4: attachSupportBehaviors

 protected function attachSupportBehaviors(Component $owner)
 {
     $rangeAttributes = [];
     foreach ($this->attributes as $attribute => $dbAttribute) {
         $rangeAttributes[] = $attribute . '_start';
         $rangeAttributes[] = $attribute . '_end';
         $owner->attachBehavior(0, ['class' => DateTimeRangeBehavior::class, 'startAttribute' => $attribute . '_start_local', 'endAttribute' => $attribute . '_end_local', 'targetAttribute' => $attribute . '_range']);
     }
     $owner->attachBehavior(0, ['class' => DateTimeBehavior::class, 'originalFormat' => ['date', 'yyyy-MM-dd'], 'targetFormat' => ['date', 'dd.MM.yyyy'], 'attributes' => $rangeAttributes]);
 }
开发者ID:omnilight,项目名称:yz2-admin,代码行数:10,代码来源:DateRangeFilteringBehavior.php

示例5: init

 public function init()
 {
     parent::init();
     //Merge main extension config with local extension config
     $config = (include dirname(__FILE__) . '/config/main.php');
     foreach ($config as $key => $value) {
         if (is_array($value)) {
             $this->{$key} = ArrayHelper::merge($value, $this->{$key});
         } elseif (null === $this->{$key}) {
             $this->{$key} = $value;
         }
     }
     if (Yii::$app instanceof Application) {
         //Merge commands map
         Yii::$app->controllerMap = ArrayHelper::merge($this->commandMap, Yii::$app->controllerMap);
         Yii::$app->controllerMap = array_filter(Yii::$app->controllerMap);
     }
     Yii::$app->setComponents($this->components);
     //Set components
     if (count($this->components)) {
         $exists = Yii::$app->getComponents(false);
         foreach ($this->components as $component => $params) {
             if (isset($exists[$component]) && is_object($exists[$component])) {
                 unset($this->components[$component]);
             } elseif (isset($exists[$component])) {
                 $this->components[$component] = ArrayHelper::merge($params, $exists[$component]);
             }
         }
         Yii::$app->setComponents($this->components, false);
     }
     Yii::setAlias('@yiicod', realpath(dirname(__FILE__) . '/..'));
 }
开发者ID:yiicod,项目名称:yii2-mailqueue,代码行数:32,代码来源:MailQueue.php

示例6: init

 public function init()
 {
     parent::init();
     if (!$this->executePath) {
         $this->executePath = \Yii::getAlias('@app');
     }
 }
开发者ID:nagser,项目名称:base,代码行数:7,代码来源:ConsoleManager.php

示例7: init

 public function init()
 {
     parent::init();
     if (Yii::$app->view !== null) {
         Yii::$app->view->on(yii\web\View::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']);
     }
 }
开发者ID:shershennm,项目名称:yii2-seo,代码行数:7,代码来源:Seo.php

示例8: init

 public function init()
 {
     parent::init();
     $this->module = \kepco\Module::getInstance();
     $this->client = new \GuzzleHttp\Client(['base_uri' => 'http://srm.kepco.net/', 'cookies' => true, 'allow_redirects' => false, 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', 'Cookie' => $this->cookie, 'X-CSRF-TOKEN' => $this->token]]);
     $this->sub = \Yii::createObject(['class' => \kepco\Redis::className(), 'hostname' => $this->module->redis_server]);
 }
开发者ID:didwjdgks,项目名称:yii2-kepco,代码行数:7,代码来源:Http.php

示例9: __construct

 /**
  * Connection constructor.
  *
  * @param XmlRpcClient $client
  * @param array        $config
  */
 public function __construct(XmlRpcClient $client, array $config = [])
 {
     parent::__construct($config);
     $this->_connection = $client;
     $this->_initConnection();
     $this->checkConnection();
 }
开发者ID:HEXA-UA,项目名称:supervisor-manager,代码行数:13,代码来源:Connection.php

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!empty($this->preLoad)) {
         $this->load($this->preLoad);
     }
 }
开发者ID:rafalkot,项目名称:yii2-settings,代码行数:10,代码来源:Settings.php

示例11: init

 public function init()
 {
     parent::init();
     if ($this->storeInSession) {
         $this->loadFromSession();
     }
 }
开发者ID:andreosoft,项目名称:andreocms,代码行数:7,代码来源:Cart.php

示例12: init

 public function init()
 {
     parent::init();
     $this->_api = new \Clickatell\Api\ClickatellHttp($this->username, $this->password, $this->apiID);
     $this->_api->secure($this->secure);
     $this->setExtraParameters();
 }
开发者ID:albertborsos,项目名称:yii2-clickatell,代码行数:7,代码来源:ClickatellHttp.php

示例13: init

 /**
  * Initializes the application component.
  */
 public function init()
 {
     parent::init();
     if ($this->identityClass === null) {
         throw new InvalidConfigException('User::identityClass must be set.');
     }
 }
开发者ID:hhy5861,项目名称:yii2-ticket,代码行数:10,代码来源:AuthApi.php

示例14: init

 /**
  * Init
  */
 public function init()
 {
     if ($this->path === null) {
         $this->setPath();
     }
     parent::init();
 }
开发者ID:yiimediafile,项目名称:mediafile,代码行数:10,代码来源:File.php

示例15: init

 public function init()
 {
     parent::init();
     if (!$this->time instanceof \DateTime) {
         throw new \yii\base\InvalidConfigException('AbstractTask::$time must be an instance of \\DateTime.');
     }
 }
开发者ID:iw-reload,项目名称:iw,代码行数:7,代码来源:AbstractTask.php


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