public function testGetEntityNames() { $manager = $this->getMockEntityManager(); $doctrine = $manager->getConfiguration()->getMetadataDriverImpl(); $reader = $doctrine->getReader(); $doctrine->expects($this->any())->method('getAllClassNames')->will($this->returnValue(['Doxport\\Metadata\\DriverTest'])); $reader->expects($this->any())->method('getClassAnnotations')->will($this->returnValue([])); $instance = new Driver($manager); $entities = $instance->getEntityNames(); $this->assertInternalType('array', $entities); }
/** * @param Driver $driver * @param callable $associationFilter * @return void */ public function from(Driver $driver, callable $associationFilter) { $entities = $driver->getEntityNames(); foreach ($entities as $entity) { $this->graph->createVertex($entity); } foreach ($entities as $entity) { foreach ($driver->getEntityMetadata($entity)->getClassMetadata()->getAssociationMappings() as $association) { if (!in_array($association['sourceEntity'], $entities) || !in_array($association['targetEntity'], $entities)) { continue; } if (!$associationFilter($association)) { continue; } $edge = $this->graph->getVertex($association['sourceEntity'])->createEdgeTo($this->graph->getVertex($association['targetEntity'])); $edge->setLayoutAttribute('label', $association['fieldName']); } } }