當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CFormModel::setAttributes方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:Diakonrus,項目名稱:fastweb-yii,代碼行數:13,代碼來源:RegistrationForm.php

示例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);
 }
開發者ID:snipesn,項目名稱:pravoved,代碼行數:11,代碼來源:UserForm.php

示例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;
     }
 }
開發者ID:Rustam44,項目名稱:ASUPortalPHP,代碼行數:17,代碼來源:CPersonForm.class.php

示例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;
     }
 }
開發者ID:hezhiwen,項目名稱:YiiSolr,代碼行數:17,代碼來源:ASolrDocument.php

示例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();
     }
 }
開發者ID:nncrypted,項目名稱:Sommelier,代碼行數:13,代碼來源:FrApiResource.php

示例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;
 }
開發者ID:andi98,項目名稱:antragsgruen,代碼行數:9,代碼來源:AdminAntragFilterForm.php


注:本文中的CFormModel::setAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。