public function createRelationsContent(ClassMetadataInterface $classMetadata, $object) { $relationsContent = new \SplObjectStorage(); foreach ($classMetadata->getRelations() as $relationMetadata) { if (null === $relationMetadata->getContent()) { continue; } $relationsContent->attach($relationMetadata, $this->getContent($relationMetadata, $object)); } return $relationsContent->count() === 0 ? null : $relationsContent; }
public function createLinksFromMetadata(ClassMetadataInterface $classMetadata, $object) { $links = array(); /** * @var RelationMetadataInterface $relationMetadata */ foreach ($classMetadata->getRelations() as $relationMetadata) { if (!$this->shouldExcludeLink($relationMetadata, $object) && ($link = $this->createLinkFromMetadata($relationMetadata, $object))) { $links[] = $link; } } return $links; }