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


PHP CActiveRecord::getAttributes方法代碼示例

本文整理匯總了PHP中CActiveRecord::getAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP CActiveRecord::getAttributes方法的具體用法?PHP CActiveRecord::getAttributes怎麽用?PHP CActiveRecord::getAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CActiveRecord的用法示例。


在下文中一共展示了CActiveRecord::getAttributes方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * Set attributes with attributes of embedded model or values specified in GET params
  */
 public function init()
 {
     $scenario = $this->getScenario();
     if ($scenario === 'search' && isset($_GET[get_called_class()])) {
         $this->setAttributes($_GET[get_called_class()], false);
     } elseif ($this->relatedModel) {
         $this->setAttributes($this->relatedModel->getAttributes(), false);
         $this->label = $this->relatedModel->getRelationshipLabel($this->myModel);
     }
 }
開發者ID:dsyman2,項目名稱:X2CRM,代碼行數:13,代碼來源:RelationshipsGridModel.php

示例2: getModelFieldList

 public function getModelFieldList()
 {
     $fields = array_keys(parent::getAttributes());
     foreach ($fields as $k => $f) {
         if ($this->tableSchema->primaryKey == $f) {
             $type = "HiddenField";
         } else {
             $type = "TextField";
         }
         $array[] = ['name' => $f, 'type' => $type, 'label' => $this->getAttributeLabel($f)];
     }
     return $array;
 }
開發者ID:rizabudi,項目名稱:plansys,代碼行數:13,代碼來源:ActiveRecord.php

示例3: getApiAttributes

 /**
  * Returns the attributes
  */
 public function getApiAttributes($names = true)
 {
     $attrs = parent::getAttributes($names);
     return $attrs;
 }
開發者ID:sjoy,項目名稱:test_api,代碼行數:8,代碼來源:ApiModel.php

示例4: getElements

 /**
  * @param CActiveRecord $model
  * @param array $attributes
  * @return array
  */
 public static function getElements($model, $attributes = [])
 {
     $modelAttributes = $model->getAttributes();
     $modelElements = [];
     foreach ($modelAttributes as $attrName => $attrVal) {
         if (!empty($attributes)) {
             foreach ($attributes as $attr) {
                 if ($attrName === $attr) {
                     $modelElements[$attr] = ['label' => $model->getAttributeLabel($attr), 'required' => $model->isAttributeRequired($attr), 'type' => 'text'];
                 }
             }
             continue;
         }
         $modelElements[$attrName] = ['label' => $model->getAttributeLabel($attrName), 'required' => $model->isAttributeRequired($attrName), 'type' => 'text'];
         //			if ($field->inputType == 'dropdownlist') {
         //				$elements['elements']['contextFields']['elements'][$field->inputName . '-' . $field->id]['items'] =
         //					Options::model()->getContextFieldOptions($field->id);
         //			}
     }
     return $modelElements;
 }
開發者ID:schrapps,項目名稱:risksur,代碼行數:26,代碼來源:ContextController.php

示例5: getAttributes

 /**
  * Returns all attribute and flags values.
  * @param array $names list of attributes whose value needs to be returned.
  * Defaults to null, meaning all attributes as listed in {@link attributeNames} and flags as listed in
  * {@link flagNames} will be returned. If it is an array, only the attributes in the array will be returned.
  * @return array attribute values (name=>value).
  */
 public function getAttributes($names = null)
 {
     $attributes = parent::getAttributes($names);
     if (is_array($names)) {
         $flags = $this->cachedFlags();
         $flagNames = array_intersect(array_keys($flags), $names);
         foreach ($flagNames as $name) {
             $attributes[$name] = $this->getFlag($flags[$name]);
         }
     }
     return $attributes;
 }
開發者ID:fduch2k,項目名稱:yii-flagged-activerecord,代碼行數:19,代碼來源:TSFlaggedActiveRecord.php

示例6: attributesOf

 /**
  * Returns the viewable attributes of an active record model in an array.
  * 
  * @param CActiveRecord $model
  */
 public function attributesOf(CActiveRecord $model)
 {
     if ($model instanceof X2Model) {
         $attributes = $model->getAttributes($model->getReadableAttributeNames());
         // Kludge for including actionDescription in Actions:
         if ($model instanceof Actions && $model->fieldPermissions['actionDescription'] >= 1) {
             $attributes['actionDescription'] = $model->getActionDescription();
         }
         return $attributes;
     } elseif ($model instanceof User) {
         $excludeAttributes = array_fill_keys(array('password', 'userKey', 'googleRefreshToken'), '');
         $attributes = array_diff_key(array_merge($model->attributes, $model->profile->attributes), $excludeAttributes);
         $uid = Yii::app()->getSuId();
         if (!Yii::app()->authManager->checkAccess('UsersAdmin', $uid) && $model->id != $uid) {
             // Attribute whitelisting for privacy
             $attributes = array_intersect_key($attributes, array_fill_keys(array('id', 'firstName', 'lastName', 'emailAddress', 'username', 'userAlias', 'fullName'), ''));
         }
         return $attributes;
     } else {
         return $model->attributes;
     }
 }
開發者ID:tymiles003,項目名稱:X2CRM,代碼行數:27,代碼來源:Api2Controller.php

示例7: getAttributes

 /**
  * The followings are the available columns in table 'users':
  * @var integer $id
  * @var string $username
  * @var string $full_name
  * @var string $password
  * @var string $email
  * @var string $activkey
  * @var integer $createtime
  * @var integer $lastvisit
  * @var integer $superuser
  * @var integer $status
  * @var timestamp $create_at
  * @var timestamp $lastvisit_at
  */
 public function getAttributes($name = true)
 {
     return parent::getAttributes($name);
 }
開發者ID:akoch-ov,項目名稱:dipstart-development,代碼行數:19,代碼來源:User.php

示例8: copyAttributes

 /**
  * Copies attributes from one active record to another, skips primary key.
  * 
  * @param CActiveRecord $from                record to copy from
  * @param CActiveRecord $to                  record to copy to
  * @param array         $skipAttributes      attribute names which should not be copied
  * @param array         $forceCopyAttributes attribute names which should be force copied
  */
 protected static function copyAttributes($from, $to, $skipAttributes = array(), $forceCopyAttributes = array())
 {
     $attributes = $from->getAttributes();
     $pk = $to->getMetaData()->tableSchema->primaryKey;
     if (!is_array($pk)) {
         $skipAttributes[] = $pk;
     } else {
         $skipAttributes = array_merge($skipAttributes, $pk);
     }
     $skipAttributes = array_diff($skipAttributes, $forceCopyAttributes);
     foreach ($skipAttributes as $attribute) {
         unset($attributes[$attribute]);
     }
     $to->setAttributes($attributes, true);
 }
開發者ID:hansenmakangiras,項目名稱:disperindag,代碼行數:23,代碼來源:CopyBehavior.php

示例9: getFilteredAttributes

 public function getFilteredAttributes(\CActiveRecord $instance)
 {
     return $instance->getAttributes(Filter::getFilter($instance->getAttributes(), get_class($instance)));
 }
開發者ID:JimmDiGriz,項目名稱:HGApi,代碼行數:4,代碼來源:CoreApiController.php

示例10: getAttributes

 public function getAttributes($names = true)
 {
     $attrs = parent::getAttributes($names);
     $attrs['displayName'] = $this->username;
     $attrs['photoThmbnl64'] = $this->getPhotoThmbnl64();
     $attrs['pageUrl'] = $this->pageUrl;
     return $attrs;
 }
開發者ID:vasiliy-pdk,項目名稱:aes,代碼行數:8,代碼來源:Profile.php

示例11: getAttributes

 public function getAttributes($names = true)
 {
     $attrs = parent::getAttributes($names);
     $attrs['imageThmbnl96'] = $this->getImageThmbnl96();
     return $attrs;
 }
開發者ID:vasiliy-pdk,項目名稱:aes,代碼行數:6,代碼來源:Election.php


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