本文整理汇总了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);
}
示例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');
}
示例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};
}
}
示例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);
}
示例5: __construct
/**
* @inheritDoc
*/
public function __construct(array $config = [])
{
$this->_model = new Tasks();
parent::__construct($this->_model->attributes(), $config);
}
示例6: __construct
/**
* @inheritDoc
*/
public function __construct($config = [])
{
$this->_model = new Deploy();
parent::__construct(array_merge($this->_model->attributes(), ['tasks_id']), $config);
}
示例7: __construct
/**
* LoginForm constructor.
*
* @param array $config Object config
*/
public function __construct($config = [])
{
$attributes = UsersModule::module()->authorizationScenario()->attributes();
parent::__construct($attributes, $config);
}
示例8: __construct
public function __construct(AbstractPermitionEntity $permition)
{
parent::__construct($permition->getAttributes());
$this->permition = $permition;
$this->attachBehaviors($permition->behaviours());
}
示例9: __construct
/**
* @inheritDoc
*/
public function __construct(array $config = [])
{
$this->_model = new Websites();
parent::__construct(['name', 'user_id', 'deploy_script', 'deploy_project', 'website'], $config);
}
示例10: __construct
/**
* 构造函数
*/
public function __construct(array $attributes = [], array $attributeLabels = [], $config = [])
{
parent::__construct($attributes, $config);
$this->_attributeLabels = $attributeLabels;
}