public function test_can_add_namespace() { $this->chain->addNamespace('NewNamespace'); $this->chain->addNamespace('NewNamespace2'); $this->chain->addNamespace('NewNamespace3'); $this->assertArrayHasKey('Namespace', $this->chain->getDrivers()); $this->assertArrayHasKey('NewNamespace', $this->chain->getDrivers()); $this->assertArrayHasKey('NewNamespace2', $this->chain->getDrivers()); $this->assertArrayHasKey('NewNamespace3', $this->chain->getDrivers()); $this->assertArrayNotHasKey('NonExisting', $this->chain->getDrivers()); }
/** * @param array $settings * @param Configuration $configuration */ protected function setCustomMappingDriverChain(array $settings = [], Configuration $configuration) { $chain = new MappingDriverChain($configuration->getMetadataDriverImpl(), 'LaravelDoctrine'); foreach (array_get($settings, 'namespaces', []) as $alias => $namespace) { if (is_string($alias)) { $configuration->addEntityNamespace($alias, $namespace); } $chain->addNamespace($namespace); } $configuration->setMetadataDriverImpl($chain); }