Commit 61a4a356 authored by jwage's avatar jwage

[2.0] Fixing ClassMetadataExporterTask to use existing configured annotation...

[2.0] Fixing ClassMetadataExporterTask to use existing configured annotation driver for given path instead of re-creating it
parent c8ef304b
......@@ -237,6 +237,21 @@ class ConvertMappingTask extends AbstractTask
$em = $this->getConfiguration()->getAttribute('em');
return $em->getConnection()->getSchemaManager();
} else if ($type == 'annotation') {
$em = $this->getConfiguration()->getAttribute('em');
$metadataDriverImpl = $em->getConfiguration()->getMetadataDriverImpl();
if ($metadataDriverImpl instanceof \Doctrine\ORM\Mapping\Driver\DriverChain) {
foreach ($metadataDriverImpl->getDrivers() as $namespace => $driver) {
if ($driver instanceof \Doctrine\ORM\Mapping\Driver\AnnotationDriver) {
$paths = $driver->getPaths();
if (in_array($source, $paths)) {
return $driver;
}
}
}
} else if ($metadataDriverImpl instanceof \Doctrine\ORM\Mapping\Driver\AnnotationDriver) {
return $metadataDriverImpl;
}
} else {
return $source;
}
......
......@@ -105,6 +105,10 @@ class ClassMetadataExporter
*/
public function getMappingDriver($type, $source = null)
{
if ($source instanceof \Doctrine\ORM\Mapping\Driver\Driver) {
return $source;
}
if ( ! isset($this->_mappingDrivers[$type])) {
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment