/** * Обработка полей 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); } }
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); }
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; } }
/** * 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; } }
/** * 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(); } }
/** * @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; }