Doesn't require paths / file extensions as entities are pull from the doctrine entity manager
Inheritance: extends AbstractDriver
Exemplo n.º 1
0
 protected function setUp()
 {
     // Register the DREST annotations
     \Drest\Mapping\Driver\AnnotationDriver::registerAnnotations();
     // Register the ORM annotations
     \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__ . '/../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     \Drest\Mapping\Driver\AnnotationDriver::registerAnnotations();
 }
Exemplo n.º 3
0
 public function testClassMetadataElementName()
 {
     $metadataFactory = new MetadataFactory(\Drest\Mapping\Driver\AnnotationDriver::create(array(__DIR__ . '/../Entities/Typical')));
     $className = 'DrestTests\\Entities\\Typical\\User';
     $cmd = $metadataFactory->getMetadataForClass($className);
     $this->assertEquals('user', $cmd->getElementName());
 }
Exemplo n.º 4
0
 /**
  * Static call to create the Drest Manager instance
  *
  * @param  EntityManager $em
  * @param  Configuration $config
  * @param  Event\Manager $eventManager
  * @return Manager       $manager
  */
 public static function create(EntityManager $em, Configuration $config, Event\Manager $eventManager = null)
 {
     // Register the annotations classes
     Mapping\Driver\AnnotationDriver::registerAnnotations();
     if ($eventManager === null) {
         $eventManager = new Event\Manager();
     }
     return new self($em, $config, $eventManager);
 }
Exemplo n.º 5
0
 public function testRemovingExtension()
 {
     $annotationDriver = \Drest\Mapping\Driver\AnnotationDriver::create(array(__DIR__ . '/../Entities/Typical'));
     $annotationDriver->removeExtensions();
     $metadataFactory = new MetadataFactory($annotationDriver);
     $this->assertCount(0, $metadataFactory->getAllClassNames());
     $annotationDriver->addExtension('php');
     $this->assertGreaterThan(0, $metadataFactory->getAllClassNames());
 }