本文整理匯總了PHP中yii\base\Model::setAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::setAttributes方法的具體用法?PHP Model::setAttributes怎麽用?PHP Model::setAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\base\Model
的用法示例。
在下文中一共展示了Model::setAttributes方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setAttributes
/**
* @inheritdoc
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
if (empty($this->images)) {
$this->images = [];
}
}
示例2: setAttributes
/**
* Override
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
if ($this->roles === "") {
$this->roles = [];
}
}
示例3: setAttributes
/**
* @inheritdoc
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
if (true === is_array($values)) {
foreach ($values as $k => $v) {
$event = new app\modules\shop\events\UserPreferenceEvent($k, $v);
$this->trigger(static::EVENT_SET_ATTRIBUTE, $event);
}
}
}
示例4: setAttributes
/**
* @param array $values
* @param bool|true $safeOnly
* @return $this
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
return $this;
}
示例5: loadAttributesFromState
/**
* Fills model attributes with previous saved state
* @param $values array of state form file
* @return bool result
*/
public function loadAttributesFromState($values)
{
parent::setAttributes($values, false);
return true;
}
示例6: setAttributes
public function setAttributes($values, $safeOnly = false)
{
parent::setAttributes($values, $safeOnly);
}