コード例 #1
0
ファイル: DriverTest.php プロジェクト: vend/doxport
 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);
 }
コード例 #2
0
ファイル: EntityGraph.php プロジェクト: vend/doxport
 /**
  * @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']);
         }
     }
 }