本文整理匯總了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;
}