/** * {@inheritdoc} */ public function getMetadata($collectionName) { if (isset($this->metadataInstances[$collectionName])) { return $this->metadataInstances[$collectionName]; } if (!$this->hasMetadata($collectionName)) { throw new NonexistentEntityException($this->translate('Cannot get metadata. Metadata for collection "{collection}" does not exist.', ['collection' => $collectionName])); } $metadata = $this->metadataFactory->create($collectionName, $this->metadata[$collectionName]); return $this->metadataInstances[$collectionName] = $metadata; }