当前位置: 首页>>代码示例>>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;未经允许,请勿转载。