当前位置: 首页>>代码示例>>PHP>>正文


PHP Property::getAttributes方法代码示例

本文整理汇总了PHP中Property::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::getAttributes方法的具体用法?PHP Property::getAttributes怎么用?PHP Property::getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Property的用法示例。


在下文中一共展示了Property::getAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareObjectAttributes

 public function prepareObjectAttributes($record)
 {
     $property = array();
     foreach ($record->metas as $meta) {
         //
         // NEED TO REFACTORED
         //
         $prop_attr['key_name'] = $meta->meta->key_name;
         $prop_attr['value'] = $meta->meta_value;
         $prop_attr['descr'] = $meta->meta->descr;
         $prop_attr['id'] = $meta->id;
         //
         // ====
         $prop = new Property();
         $prop->setAttributes($prop_attr);
         $property[] = $prop->getAttributes();
     }
     $objects = array();
     foreach ($record->objects as $object) {
         $objects[] = array('name' => $object->name, 'text_value' => $object->text_value, 'descr' => $object->descr, 'id' => $object->id);
     }
     $attr = $record->getAttributes();
     $attr['type'] = $record->type->name;
     $attr['property'] = $property;
     $attr['objects'] = $objects;
     return $attr;
 }
开发者ID:rosko,项目名称:AlmazService,代码行数:27,代码来源:YiiResourceFinder.php

示例2: ClientType

 /**
  *
  * @param <string> $type
  * Constructor
  */
 public function ClientType($type)
 {
     $this->_attributes = array();
     $this->_properties = array();
     $this->_navigationProperties = array();
     $this->_sortedEPMProperties = array();
     $targetPathToCount = array();
     try {
         $rClass = new ReflectionClass($type);
         $this->_hasEPM = false;
         $this->_attributes = Utility::getAttributes($rClass);
         $sourceProperty = null;
         if (array_key_exists('FC_SourcePath', $this->_attributes)) {
             $this->_hasEPM = true;
             $sourceProperty = $this->_attributes['FC_SourcePath'];
         }
         $properties = $rClass->getProperties();
         foreach ($properties as $property) {
             if ($property->isPublic()) {
                 $attributes = Utility::getAttributes($property);
                 $propertyName = $property->name;
                 if ($sourceProperty != null && $sourceProperty == $propertyName) {
                     ValidateEPMAttributes($this->_attributes, $attributes, $sourceProperty, false);
                 }
                 if (isset($attributes['Type']) && $attributes['Type'] == 'EntityProperty') {
                     $propertyObj = new Property($propertyName, $attributes);
                     $this->_properties[$propertyName] = $propertyObj;
                     if ($propertyObj->hasEPM($syn)) {
                         $this->_hasEPM = true;
                         $attrs = $propertyObj->getAttributes();
                         if ($syn) {
                             $targetPath = SyndicationItemProperty::GetSyndicationItemPathNoNS($attrs['FC_TargetPath']);
                         } else {
                             $targetPath = $attrs['FC_TargetPathNS'];
                             if (isset($attrs['NodeAttribute'])) {
                                 $targetPath .= '/@' . $attrs['NodeAttribute'];
                             }
                         }
                         $targetPathToCount[$targetPath] = substr_count($targetPath, "/");
                     }
                 } else {
                     if (isset($attributes['Type']) && $attributes['Type'] == 'NavigationProperty') {
                         $this->_navigationProperties[$propertyName] = new Property($propertyName, $attributes);
                     }
                 }
             }
         }
         asort($targetPathToCount);
         $properties = $this->_properties;
         foreach ($targetPathToCount as $key => $value) {
             foreach ($properties as $property) {
                 $syn = false;
                 $targetPath = null;
                 if ($property->hasEPM($syn)) {
                     $attrs = $property->getAttributes();
                     if ($syn) {
                         $targetPath = SyndicationItemProperty::GetSyndicationItemPathNoNS($attrs['FC_TargetPath']);
                     } else {
                         $targetPath = $attrs['FC_TargetPathNS'];
                         if (isset($attrs['NodeAttribute'])) {
                             $targetPath .= '/@' . $attrs['NodeAttribute'];
                         }
                     }
                     if ($key == $targetPath) {
                         $this->_sortedEPMProperties[] = $property;
                     }
                 }
             }
         }
     } catch (ReflectionException $exception) {
         throw new InvalidOperation('ReflectionException in ClientType constructor');
     }
 }
开发者ID:zzzaaa,项目名称:odataphp,代码行数:78,代码来源:ClientType.php


注:本文中的Property::getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。