/** * Returns metadata for the specified document class short name (e.g AppBundle:Product) * * @param string $documentClass * @return DocumentMetadata */ public function getDocumentMetadata($documentClass) { $documentClass = $this->documentLocator->getShortClassName($documentClass); foreach ($this->metadata as $index => $types) { foreach ($types as $typeDocumentClass => $documentMetadata) { if ($documentClass === $typeDocumentClass) { return $documentMetadata; } } } throw new \InvalidArgumentException(sprintf('Metadata for type "%s" is not available', $documentClass)); }
/** * Returns document mapping with metadata * * @param string $documentClassName * @param array $indexAnalyzers * * @return array */ public function getMetadataFromClass($documentClassName, array $indexAnalyzers) { $metadata = $this->getDocumentReflectionMetadata(new \ReflectionClass($this->documentLocator->resolveClassName($documentClassName)), $indexAnalyzers); return $metadata; }