Skip to content

Commit

Permalink
[DoctrineBundle] Integrating the new Doctrine 2.0 entity alias featur…
Browse files Browse the repository at this point in the history
…e for the query language
  • Loading branch information
jwage authored and fabpot committed Mar 1, 2010
1 parent 42ad9b7 commit 47aee04
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -213,6 +213,17 @@ public function ormLoad($config)
elseif (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entities'))
{
$type = 'annotation';

$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\');
$annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, $dir);
$classNames = $annotationDriver->getAllClassNames();
foreach ($classNames as $className)
{
$alias = substr_replace($className, '', 0, strpos($className, '\\') + 1);
$alias = str_replace('\Entities\\', '\\', $alias);
$ormConfigDef->addMethodCall('addEntityAlias', array($className, $alias));
}
}
else
{
Expand Down

0 comments on commit 47aee04

Please sign in to comment.