Beispiel #1
0
 /**
  * @param  object $object
  * @param  Metadata $metadata
  * @return Collection
  */
 public function createCollectionFromMetadata($object, Metadata $metadata)
 {
     $jsonLDCollection = new Collection($object);
     $jsonLDCollection->setCollectionName($metadata->getCollectionName());
     $jsonLDCollection->setCollectionRoute($metadata->getRoute());
     $jsonLDCollection->setEntityRoute($metadata->getEntityRoute());
     $jsonLDCollection->setRouteIdentifierName($metadata->getRouteIdentifierName());
     $jsonLDCollection->setEntityIdentifierName($metadata->getEntityIdentifierName());
     $properties = $jsonLDCollection->getProperties();
     $this->marshalMetadataProperties($metadata, $properties);
     $forceFullUriID = $metadata->getForceFullUriID();
     if ($forceFullUriID && !$properties->has('id') && ($metadata->hasUrl() || $metadata->hasRoute())) {
         $property = $this->marshalPropertyFromMetadata($metadata, $object);
         $properties->add($property);
     }
     return $jsonLDCollection;
 }