Skip to content

Instantly share code, notes, and snippets.

@nexik
Created October 17, 2015 20:46
Show Gist options
  • Select an option

  • Save nexik/3bfe4b11bf4ba93bfce8 to your computer and use it in GitHub Desktop.

Select an option

Save nexik/3bfe4b11bf4ba93bfce8 to your computer and use it in GitHub Desktop.
doctrine custom mapping
<?php
namespace AppBundle;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
public function build(ContainerBuilder $builder)
{
$builder->addCompilerPass($this->buildMappingCompilerPass());
}
private function buildMappingCompilerPass()
{
return DoctrineOrmMappingsPass::createYamlMappingDriver(
[
__DIR__ . '/Resources/doctrine/common' => 'App\Common',
__DIR__ . '/Resources/doctrine/security' => 'App\Security',
]
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment