当前位置: 首页>>代码示例>>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;未经允许,请勿转载。