Ejemplo n.º 1
0
 public function testPaths()
 {
     $driver = new ChainedDriver([]);
     $this->assertEquals([], $driver->getPaths());
     $driver->addPaths(['/tmp/classes', __DIR__ . '/Mappers']);
     $this->assertEquals(['/tmp/classes', __DIR__ . '/Mappers'], $driver->getPaths());
     $driver->addPaths([__DIR__ . '/test', '/tmp/otherclasses']);
     $this->assertEquals(['/tmp/classes', __DIR__ . '/Mappers', __DIR__ . '/test', '/tmp/otherclasses'], $driver->getPaths());
     $driver->addPaths(['/tmp/classes']);
     $this->assertEquals(['/tmp/classes', __DIR__ . '/Mappers', __DIR__ . '/test', '/tmp/otherclasses'], $driver->getPaths());
 }
Ejemplo n.º 2
0
 /**
  * @return ClassMetadata
  * @throws \Exception
  */
 protected static function _getMetadata()
 {
     $className = get_called_class();
     if (!isset(self::$classMetadata[$className])) {
         self::$classMetadata[$className] = new ClassMetadata($className);
         $driver = new ChainedDriver([(new Configuration())->newDefaultAnnotationDriver(), new AutoMappingDriver('string')]);
         $driver->loadMetadataForClass($className, self::$classMetadata[$className]);
     }
     return self::$classMetadata[$className];
 }