當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。