示例#1
0
 /**
  * @param ContentEntity $contentEntity
  * @return array
  */
 public function getContentAllMeta($contentEntity)
 {
     $returnValue = array();
     $classInstance = $this->getContentClass($contentEntity->getType(), $contentEntity->getSchema());
     $loadedMeta = $contentEntity->getLoadedMeta();
     if (!is_null($loadedMeta)) {
         return $loadedMeta;
     }
     $existingMeta = $contentEntity->getMeta();
     if (!empty($existingMeta)) {
         /**
          * @var ContentMetaEntity $meta
          */
         foreach ($existingMeta as $meta) {
             $metaField = $meta->getField();
             $metaValue = $meta->getValue();
             $metaType = $meta->getFieldType();
             $metaValue = $this->decodeDataFromDB($metaType, $metaField, $metaValue, $classInstance);
             if ($metaType == ContentFieldType::Content) {
                 if (!is_array($metaValue) && !is_null($metaValue)) {
                     $metaValue = $this->getContentRepository()->find($metaValue);
                 }
             }
             if ($metaType == ContentFieldType::Custom) {
                 $metaValue = $classInstance->loadCustomField($metaField, $metaValue);
             }
             $returnValue[$metaField] = $metaValue;
         }
     }
     $contentEntity->setLoadedMeta($returnValue);
     return $returnValue;
 }