8000 [DoctrineBundle] fixed the overridding of an Entity · CodingFabian/symfony@fff1334 · GitHub
[go: up one dir, main page]

Skip to content

Commit fff1334

Browse files
committed
[DoctrineBundle] fixed the overridding of an Entity
1 parent dad7552 commit fff1334

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,35 +201,37 @@ public function ormLoad($config)
201201
$bundleEntityMappings = array();
202202
$bundleDirs = $this->bundleDirs;
203203
$aliasMap = array();
204-
foreach ($this->bundles as $className)
204+
foreach (array_reverse($this->bundles) as $className)
205205
{
206206
$tmp = dirname(str_replace('\\', '/', $className));
207207
$namespace = str_replace('/', '\\', dirname($tmp));
208208
$class = basename($tmp);
209209

210210
if (isset($bundleDirs[$namespace]))
211211
{
212-
$type = false;
213-
if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Resources/config/doctrine/metadata'))
214-
{
215-
$type = $this->detectMappingType($dir);
216-
}
217-
218-
if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entities'))
219-
{
220-
$type = 'annotation';
221-
222-
$aliasMap[$class] = $namespace.'\\'.$class.'\\Entities';
223-
}
224-
225-
if (false !== $type)
226-
{
227-
$mappingDriverDef->addMethodCall('addDriver', array(
228-
new Reference(sprintf('doctrine.orm.metadata_driver.%s', $type)),
229-
$namespace.'\\'.$class.'\\Entities'
230-
)
231-
);
232-
}
212+
continue;
213+
}
214+
215+
$type = false;
216+
if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Resources/config/doctrine/metadata'))
217+
{
218+
$type = $this->detectMappingType($dir);
219+
}
220+
221+
if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entities'))
222+
{
223+
$type = 'annotation';
224+
225+
$aliasMap[$class] = $namespace.'\\'.$class.'\\Entities';
226+
}
227+
228+
if (false !== $type)
229+
{
230+
$mappingDriverDef->addMethodCall('addDriver', array(
231+
new Reference(sprintf('doctrine.orm.metadata_driver.%s', $type)),
232+
$namespace.'\\'.$class.'\\Entities'
233+
)
234+
);
233235
}
234236
}
235237
$ormConfigDef->addMethodCall('setEntityNamespaces', array($aliasMap));

0 commit comments

Comments
 (0)
0