/**
  * {@inheritdoc}
  */
 public function getValue($entity, FieldMetadata $metadata)
 {
     $doctrineMetadata = $metadata->getDoctrineMetadata();
     $fieldName = $doctrineMetadata->getFieldName();
     $className = $doctrineMetadata->get('sourceEntity');
     return $this->doctrineHelper->getEntityRepository($className)->findBy([$fieldName => $entity]);
 }
Пример #2
0
 public function testGetEntityRepository()
 {
     $entityName = 'TestEntity';
     $this->entityManager->expects($this->once())->method('getRepository')->with($entityName)->will($this->returnValue($this->repository));
     $this->assertEquals($this->repository, $this->doctrineHelper->getEntityRepository($entityName));
 }