/**
  * Gets the entrypoint of the API.
  *
  * return array
  */
 public function getEntrypoint()
 {
     $entrypoint = ['@context' => $this->router->generate('api_json_ld_entrypoint_context'), '@id' => $this->router->generate('api_json_ld_entrypoint'), '@type' => 'Entrypoint'];
     foreach ($this->resourceCollection as $resource) {
         $entrypoint[lcfirst($resource->getShortName())] = $this->iriConverter->getIriFromResource($resource);
     }
     return $entrypoint;
 }
 /**
  * @param AttributeMetadataInterface $attributeMetadata
  *
  * @return mixed
  */
 public function guess(AttributeMetadataInterface $attributeMetadata)
 {
     $value = null;
     $type = null;
     if (true === ($isDoctrine = isset($attributeMetadata->getTypes()[0]))) {
         $type = $attributeMetadata->getTypes()[0];
     }
     // Guess associations
     if ($isDoctrine && 'object' === $type->getType() && 'DateTime' !== $type->getClass()) {
         $class = $type->isCollection() ? $type->getCollectionType()->getClass() : $type->getClass();
         $resource = $this->resourceCollection->getResourceForEntity($class);
         $classMetadata = $this->classMetadataFactory->getMetadataFor($resource->getEntityClass(), $resource->getNormalizationGroups(), $resource->getDenormalizationGroups(), $resource->getValidationGroups());
         $id = $this->guess($classMetadata->getIdentifier());
         $value = $this->iriConverter->getIriFromResource($resource) . '/' . $id;
         if ($type->isCollection()) {
             $value = [$value];
         }
     }
     // Guess by faker
     if (null === $value) {
         try {
             $value = call_user_func([$this->generator, $attributeMetadata->getName()]);
         } catch (\InvalidArgumentException $e) {
         }
     }
     // Guess by field name
     if (null === $value) {
         $value = $this->guessFormat(Inflector::tableize($attributeMetadata->getName()));
     }
     // Guess by Doctrine type
     if (null === $value && $isDoctrine) {
         switch ($type->getType()) {
             case 'string':
                 $value = $this->generator->sentence;
                 break;
             case 'int':
                 $value = $this->generator->numberBetween;
                 break;
             case 'bool':
                 $value = $this->generator->boolean;
                 break;
             case 'object':
                 if ('DateTime' !== $type->getClass()) {
                     throw new \InvalidArgumentException(sprintf('Unknown Doctrine object type %s in field %s', $type->getClass(), $attributeMetadata->getName()));
                 }
                 $value = $this->generator->dateTime;
                 break;
         }
     }
     return $this->clean($value);
 }
 /**
  * Gets the entrypoint of the API.
  *
  * return array
  */
 public function getEntrypoint()
 {
     $entrypoint = ['@context' => $this->router->generate('api_json_ld_entrypoint_context'), '@id' => $this->router->generate('api_json_ld_entrypoint'), '@type' => 'Entrypoint'];
     foreach ($this->resourceCollection as $resource) {
         if (is_null($resource->getParent())) {
             foreach ($resource->getCollectionOperations() as $operation) {
                 if (in_array('GET', $operation->getRoute()->getMethods())) {
                     $entrypoint[lcfirst($resource->getShortName())] = $this->iriConverter->getIriFromResource($resource);
                     break;
                 }
             }
         }
     }
     return $entrypoint;
 }
 /**
  * Gets the entrypoint of the API.
  *
  * @return array
  */
 public function getEntrypoint()
 {
     $entrypoint = ['@context' => $this->router->generate('api_jsonld_context', ['shortName' => 'Entrypoint']), '@id' => $this->router->generate('api_jsonld_entrypoint'), '@type' => 'Entrypoint'];
     foreach ($this->resourceCollection as $resource) {
         if (!empty($resource->getCollectionOperations())) {
             try {
                 $entrypoint[lcfirst($resource->getShortName())] = $this->iriConverter->getIriFromResource($resource);
             } catch (InvalidArgumentException $ex) {
                 if ($this->hasGetCollectionOperation($resource)) {
                     throw $ex;
                 }
             }
         }
     }
     return $entrypoint;
 }