예제 #1
0
 /**
  * @param SessionInterface $session
  * @param ObjectDataInterface $objectData
  */
 public function __construct(SessionInterface $session, ObjectDataInterface $objectData)
 {
     $objectFactory = $session->getObjectFactory();
     $properties = $objectData->getProperties();
     // handle properties
     if (!empty($properties)) {
         $queryProperties = $objectFactory->convertQueryProperties($properties);
         foreach ($queryProperties as $queryProperty) {
             if ($queryProperty->getId() !== null) {
                 $this->propertiesById[$queryProperty->getId()] = $queryProperty;
             }
             if ($queryProperty->getQueryName() !== null) {
                 $this->propertiesByQueryName[$queryProperty->getQueryName()] = $queryProperty;
             }
         }
     }
     // handle allowable actions
     $allowableActions = $objectData->getAllowableActions();
     if ($allowableActions !== null) {
         $this->allowableActions = $allowableActions;
     }
     // handle relationships
     $relationshipsObjectData = $objectData->getRelationships();
     foreach ($relationshipsObjectData as $relationshipObjectData) {
         $relationship = $objectFactory->convertObject($relationshipObjectData, $session->getDefaultContext());
         if ($relationship instanceof RelationshipInterface) {
             $this->relationships[] = $relationship;
         }
     }
     // handle renditions
     $renditionsData = $objectData->getRenditions();
     foreach ($renditionsData as $renditionData) {
         $rendition = $objectFactory->convertRendition($objectData->getId(), $renditionData);
         if ($rendition instanceof RenditionInterface) {
             $this->renditions[] = $rendition;
         }
     }
 }