當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DynamicModel::__construct方法代碼示例

本文整理匯總了PHP中yii\base\DynamicModel::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP DynamicModel::__construct方法的具體用法?PHP DynamicModel::__construct怎麽用?PHP DynamicModel::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\DynamicModel的用法示例。


在下文中一共展示了DynamicModel::__construct方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(&$code, $poll_id = null)
 {
     // here i must get the valid attributes which can be set through the poll questions
     // and define the attributes and maybe set the default values.
     if ($code) {
         $this->_code = $code;
         if (!$this->getPoll()) {
             throw new Exception("Poll selection failed", 1);
         }
         if (!$this->getOptions()) {
             throw new Exception("Option selection failed", 1);
         }
         $this->header = $this->_poll->title;
         $this->question = $this->_poll->question;
         // set the min and max options to be selected
         $this->_min_options = $this->_poll->select_min;
         $this->_max_options = $this->_poll->select_max;
         $this->defineAttribute('options', $value = null);
         $this->defineAttribute('vote_submitted', $value = 1);
         $this->setOptionRules();
     } elseif (isset($poll_id)) {
         $this->setPreviewMode($poll_id);
     }
     $attributes = [];
     $config = [];
     parent::__construct($attributes, $config);
 }
開發者ID:EuresTools,項目名稱:eVote-web,代碼行數:27,代碼來源:VotingForm.php

示例2: __construct

 /**
  * @param \yii\db\ActiveRecord $baseModel
  * @param array $config
  */
 public function __construct($baseModel, $propertyGroups, $config = [])
 {
     $this->baseModel = $baseModel;
     $this->propertyGroups = $propertyGroups;
     $attributes = $this->baseModel->activeAttributes();
     foreach ($this->propertyGroups as $groupId => $properties) {
         $attributes = ArrayHelper::merge($attributes, array_keys($properties));
     }
     parent::__construct($attributes, $config);
     $this->addRule($attributes, 'safe');
 }
開發者ID:yii2ApplicationCollect,項目名稱:dotplant2,代碼行數:15,代碼來源:DynamicSearchModel.php

示例3: __construct

 /**
  * BaseConfigurationModel constructor.
  * There are a building of rules, a building of attributeLabels and attributes definition here.
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     $attributes = [];
     foreach ($this->rules() as $rules) {
         $attributes = ArrayHelper::merge($attributes, (array) $rules[0]);
     }
     $attributes = array_unique($attributes);
     parent::__construct($attributes, $config);
     $module = call_user_func([$this->getModuleClassName(), 'module']);
     foreach ($attributes as $name) {
         $this->{$name} = $module->{$name};
     }
 }
開發者ID:DevGroup-ru,項目名稱:yii2-extensions-manager,代碼行數:18,代碼來源:BaseConfigurationModel.php

示例4: __construct

 /**
  * @inheritdoc
  */
 public function __construct($name, $attributes = [], $config = [])
 {
     $this->_name = $name;
     $definition = isset(static::$defintions[$name]) ? static::$defintions[$name] : ['attrs' => $attributes];
     $attributes = array_merge(ArrayHelper::getValue($definition, 'attrs', []), $attributes);
     foreach (['formName', 'rules', 'behaviors', 'methods'] as $attr) {
         if (array_key_exists($attr, $config)) {
             $definition[$name][$attr] = $config[$attr];
             unset($config[$attr]);
         }
     }
     if (!isset(static::$defintions[$name])) {
         static::$defintions[$name] = $definition;
     }
     $this->_formName = ArrayHelper::getValue($definition, 'formName');
     $this->_rules = ArrayHelper::getValue($definition, 'rules', []);
     $this->_behaviors = ArrayHelper::getValue($definition, 'behaviors', []);
     $this->_methods = ArrayHelper::getValue($definition, 'methods', []);
     parent::__construct($attributes, $config);
 }
開發者ID:deesoft,項目名稱:yii2-tools,代碼行數:23,代碼來源:DeeModel.php

示例5: __construct

 /**
  * @inheritDoc
  */
 public function __construct(array $config = [])
 {
     $this->_model = new Tasks();
     parent::__construct($this->_model->attributes(), $config);
 }
開發者ID:Choate,項目名稱:coderelease,代碼行數:8,代碼來源:TasksForm.php

示例6: __construct

 /**
  * @inheritDoc
  */
 public function __construct($config = [])
 {
     $this->_model = new Deploy();
     parent::__construct(array_merge($this->_model->attributes(), ['tasks_id']), $config);
 }
開發者ID:Choate,項目名稱:coderelease,代碼行數:8,代碼來源:DeployForm.php

示例7: __construct

 /**
  * LoginForm constructor.
  *
  * @param array $config Object config
  */
 public function __construct($config = [])
 {
     $attributes = UsersModule::module()->authorizationScenario()->attributes();
     parent::__construct($attributes, $config);
 }
開發者ID:cheaterBY,項目名稱:yii2-users-module,代碼行數:10,代碼來源:LoginForm.php

示例8: __construct

 public function __construct(AbstractPermitionEntity $permition)
 {
     parent::__construct($permition->getAttributes());
     $this->permition = $permition;
     $this->attachBehaviors($permition->behaviours());
 }
開發者ID:Vlsirko,項目名稱:yii2-rbac,代碼行數:6,代碼來源:ActiveRecordAdapter.php

示例9: __construct

 /**
  * @inheritDoc
  */
 public function __construct(array $config = [])
 {
     $this->_model = new Websites();
     parent::__construct(['name', 'user_id', 'deploy_script', 'deploy_project', 'website'], $config);
 }
開發者ID:Choate,項目名稱:coderelease,代碼行數:8,代碼來源:WebsiteForm.php

示例10: __construct

 /**
  * 構造函數
  */
 public function __construct(array $attributes = [], array $attributeLabels = [], $config = [])
 {
     parent::__construct($attributes, $config);
     $this->_attributeLabels = $attributeLabels;
 }
開發者ID:phpdn,項目名稱:qc-base,代碼行數:8,代碼來源:DynamicModel.php


注:本文中的yii\base\DynamicModel::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。