本文整理汇总了PHP中CFormModel::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::setAttributes方法的具体用法?PHP CFormModel::setAttributes怎么用?PHP CFormModel::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormModel
的用法示例。
在下文中一共展示了CFormModel::setAttributes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAttributes
/**
* Обработка полей birthday
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
if (!$this->birthday_day && !$this->birthday_month && !$this->birthday_year) {
$birthday = strtotime($this->birthday);
$this->birthday_day = date('j', $birthday);
$this->birthday_month = date('n', $birthday);
$this->birthday_year = date('Y', $birthday);
}
}
示例2: setAttributes
public function setAttributes($values, $safeOnly = true)
{
if ($this->getScenario() == 'registration') {
if ($values['type'] == UserModel::TYPE_JURIST) {
$this->setScenario('reg_jurist');
} else {
$this->setScenario('reg_client');
}
}
return parent::setAttributes($values, $safeOnly);
}
示例3: setAttributes
public function setAttributes(array $array)
{
parent::setAttributes($array);
$personArr = $this->person;
if (array_key_exists("types", $personArr)) {
$this->_types = $personArr["types"];
unset($personArr["types"]);
}
$this->person = new CPerson();
$this->person->setAttributes($personArr);
if (!is_null($this->to_tabel)) {
$this->person->to_tabel = $this->to_tabel;
}
if (!is_null($this->is_slave)) {
$this->person->is_slave = $this->is_slave;
}
}
示例4: setAttributes
/**
* Sets the attribute values in a massive way.
* @param array $values attribute values (name=>value) to be set.
* @param boolean $safeOnly whether the assignments should only be done to the safe attributes.
* A safe attribute is one that is associated with a validation rule in the current {@link scenario}.
* @see getSafeAttributeNames
* @see attributeNames
*/
public function setAttributes($values, $safeOnly = true)
{
if ($safeOnly) {
return parent::setAttributes($values, true);
}
foreach ($values as $attribute => $value) {
$this->{$attribute} = $value;
}
}
示例5: setAttributes
/**
* Besides standard mass setter translate values back to model attributes for
* active record.
* @param array $values
* @param boolean $updateActiveModel we don't want to update model attributes after find
*/
public function setAttributes($values, $updateActiveModel = true)
{
parent::setAttributes($values, true);
if ($updateActiveModel) {
$this->updateModelAttributes();
}
}
示例6: setAttributes
/**
* @param array $values
* @param bool $safeOnly
*/
public function setAttributes($values, $safeOnly = true)
{
parent::setAttributes($values, $safeOnly);
$this->status = isset($values["status"]) && $values["status"] != "" ? IntVal($values["status"]) : null;
}