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


PHP Behavior::init方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     $this->target = Yii::createObject($this->targetClass);
     if (!$this->condition) {
         $this->target = $this->target->findOne($this->condition);
     }
 }
开发者ID:shuangjie,项目名称:galaxy,代码行数:8,代码来源:RecordBehavior.php

示例2: init

 /**
  * Инициализация
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (empty($this->attribute)) {
         throw new InvalidConfigException("Class property 'attribute' does`t set");
     }
     parent::init();
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:11,代码来源:ArraySerializer.php

示例3: init

 public function init()
 {
     parent::init();
     if (!$this->versionTable) {
         throw new Exception(\Yii::t('app', 'Version table not defined'));
     }
 }
开发者ID:elitedivision,项目名称:amos-core,代码行数:7,代码来源:VersionableBehaviour.php

示例4: init

 /**
  *
  */
 public function init()
 {
     parent::init();
     if (!is_array($this->columnValues) || count($this->columnValues) == 0) {
         throw new \InvalidArgumentException('Нужно задать значения для вывода');
     }
 }
开发者ID:mosedu,项目名称:confprof,代码行数:10,代码来源:ExcelexportBehavior.php

示例5: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->attributes)) {
         $this->attributes = [BaseActiveRecord::EVENT_AFTER_INSERT => [], BaseActiveRecord::EVENT_BEFORE_UPDATE => [], BaseActiveRecord::EVENT_BEFORE_DELETE => []];
     }
 }
开发者ID:yariksav,项目名称:yii2-actives,代码行数:10,代码来源:UserActivityBehavior.php

示例6: init

 /**
  * Инициализация
  */
 public function init()
 {
     if (!is_array($this->apps)) {
         $this->apps = [$this->apps];
     }
     parent::init();
 }
开发者ID:nazartsev,项目名称:yii2-data-log,代码行数:10,代码来源:DataLogBehavior.php

示例7: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (is_null($this->values)) {
         $this->values = time();
     }
 }
开发者ID:lebedyncrs,项目名称:yii2-attrswatcher,代码行数:10,代码来源:AttrsWatcherBehavior.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->attributes)) {
         throw new InvalidConfigException('The "attributes" property must be set.');
     }
 }
开发者ID:Brother-Simon,项目名称:yii2-wechat,代码行数:10,代码来源:ArrayBehavior.php

示例9: init

 public function init()
 {
     parent::init();
     if (!is_array($this->attributes)) {
         $this->attributes = [$this->attributes];
     }
 }
开发者ID:su-xiaolin,项目名称:ICShop-Yii,代码行数:7,代码来源:TrimBehavior.php

示例10: init

 public function init()
 {
     if (!is_array($this->counters)) {
         throw new InvalidParamException('counters property should be array');
     }
     return parent::init();
 }
开发者ID:ostapetc,项目名称:yii2-cache-counter-behavior,代码行数:7,代码来源:CounterCacheBehavior.php

示例11: init

 /**
  * Init
  */
 public function init()
 {
     if ($this->attributes == null) {
         throw new InvalidConfigException('Property "attributes" must be set');
     }
     parent::init();
 }
开发者ID:voskobovich,项目名称:yii2-copy-value-behavior,代码行数:10,代码来源:CopyValueBehavior.php

示例12: init

 /**
  * Invokes init of parent class and assigns proper values to internal _fields variable
  */
 public function init()
 {
     parent::init();
     //configure _fields
     foreach ($this->relations as $attributeName => $params) {
         //add primary field
         $this->_fields[$attributeName] = ['attribute' => $attributeName];
         if (isset($params['get'])) {
             $this->_fields[$attributeName]['get'] = $params['get'];
         }
         if (isset($params['set'])) {
             $this->_fields[$attributeName]['set'] = $params['set'];
         }
         //add secondary fields
         if (isset($params['fields'])) {
             foreach ($params['fields'] as $fieldName => $params) {
                 $fullFieldName = $attributeName . '_' . $fieldName;
                 if (isset($this->_fields[$fullFieldName])) {
                     throw new ErrorException("Ambiguous field name definition: {$fullFieldName}");
                 }
                 $this->_fields[$fullFieldName] = ['attribute' => $attributeName];
                 if (isset($params['get'])) {
                     $this->_fields[$fullFieldName]['get'] = $params['get'];
                 }
                 if (isset($params['set'])) {
                     $this->_fields[$fullFieldName]['set'] = $params['set'];
                 }
             }
         }
     }
 }
开发者ID:vasyldorosh,项目名称:ManyToManyBehavior,代码行数:34,代码来源:ManyToManyBehavior.php

示例13: init

 public function init()
 {
     if (is_null($this->generators)) {
         $this->generators = $this->defaultGenerators();
     }
     parent::init();
 }
开发者ID:tebazil,项目名称:yii2-vodka-behavior,代码行数:7,代码来源:VodkaBehavior.php

示例14: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->related === null) {
         throw new InvalidConfigException('The "related" property must be set.');
     }
 }
开发者ID:veksa,项目名称:variation,代码行数:10,代码来源:VariationBehavior.php

示例15: init

 public function init()
 {
     parent::init();
     if (!$this->meta) {
         $this->meta = ['title' => 'title'];
     }
 }
开发者ID:yeesoft,项目名称:yii2-yee-seo,代码行数:7,代码来源:SeoModelBehavior.php


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