* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sonata\Doctrine\Bridge\Symfony\DependencyInjection; use Doctrine\ODM\PHPCR\DocumentManager; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * @author Thomas Rabaix */ class SonataDoctrineExtension extends Extension { /** * @param mixed[] $configs * * @return void */ public function load(array $configs, ContainerBuilder $container) { $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.php'); if (interface_exists(EntityManagerInterface::class)) { $loader->load('doctrine_orm.php'); $loader->load('mapper_orm.php'); } $bundles = $container->getParameter('kernel.bundles'); \assert(\is_array($bundles)); // NEXT_MAJOR: Remove this if (class_exists(DocumentManager::class) && isset($bundles['DoctrinePHPCRBundle'])) { $loader->load('doctrine_phpcr.php'); } } }