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; }
/** * * @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'); } }