Initial commit with Symfony 2.1+Vendors
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
10
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/.travis.yml
vendored
Normal file
10
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/.travis.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
|
||||
before_script:
|
||||
- wget http://getcomposer.org/composer.phar
|
||||
- php composer.phar install --dev
|
||||
|
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
|
||||
/**
|
||||
* Database tool allows you to easily drop and create your configured databases.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class CreateDatabaseDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:database:create')
|
||||
->setDescription('Creates the configured databases')
|
||||
->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:database:create</info> command creates the default
|
||||
connections database:
|
||||
|
||||
<info>php app/console doctrine:database:create</info>
|
||||
|
||||
You can also optionally specify the name of a connection to create the
|
||||
database for:
|
||||
|
||||
<info>php app/console doctrine:database:create --connection=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$connection = $this->getDoctrineConnection($input->getOption('connection'));
|
||||
|
||||
$params = $connection->getParams();
|
||||
$name = isset($params['path']) ? $params['path'] : $params['dbname'];
|
||||
|
||||
unset($params['dbname']);
|
||||
|
||||
$tmpConnection = DriverManager::getConnection($params);
|
||||
|
||||
// Only quote if we don't have a path
|
||||
if (!isset($params['path'])) {
|
||||
$name = $tmpConnection->getDatabasePlatform()->quoteSingleIdentifier($name);
|
||||
}
|
||||
|
||||
try {
|
||||
$tmpConnection->getSchemaManager()->createDatabase($name);
|
||||
$output->writeln(sprintf('<info>Created database for connection named <comment>%s</comment></info>', $name));
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln(sprintf('<error>Could not create database for connection named <comment>%s</comment></error>', $name));
|
||||
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
|
||||
}
|
||||
|
||||
$tmpConnection->close();
|
||||
}
|
||||
}
|
55
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php
vendored
Normal file
55
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/DoctrineCommand.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Doctrine\ORM\Tools\EntityGenerator;
|
||||
|
||||
/**
|
||||
* Base class for Doctrine console commands to extend from.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class DoctrineCommand extends ContainerAwareCommand
|
||||
{
|
||||
protected function getEntityGenerator()
|
||||
{
|
||||
$entityGenerator = new EntityGenerator();
|
||||
$entityGenerator->setGenerateAnnotations(false);
|
||||
$entityGenerator->setGenerateStubMethods(true);
|
||||
$entityGenerator->setRegenerateEntityIfExists(false);
|
||||
$entityGenerator->setUpdateEntityIfExists(true);
|
||||
$entityGenerator->setNumSpaces(4);
|
||||
$entityGenerator->setAnnotationPrefix('ORM\\');
|
||||
|
||||
return $entityGenerator;
|
||||
}
|
||||
|
||||
protected function getEntityManager($name)
|
||||
{
|
||||
return $this->getContainer()->get('doctrine')->getManager($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a doctrine dbal connection by symfony name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected function getDoctrineConnection($name)
|
||||
{
|
||||
return $this->getContainer()->get('doctrine')->getConnection($name);
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Database tool allows you to easily drop and create your configured databases.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class DropDatabaseDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:database:drop')
|
||||
->setDescription('Drops the configured databases')
|
||||
->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
|
||||
->addOption('force', null, InputOption::VALUE_NONE, 'Set this parameter to execute this action')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:database:drop</info> command drops the default connections
|
||||
database:
|
||||
|
||||
<info>php app/console doctrine:database:drop</info>
|
||||
|
||||
The --force parameter has to be used to actually drop the database.
|
||||
|
||||
You can also optionally specify the name of a connection to drop the database
|
||||
for:
|
||||
|
||||
<info>php app/console doctrine:database:drop --connection=default</info>
|
||||
|
||||
<error>Be careful: All data in a given database will be lost when executing
|
||||
this command.</error>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$connection = $this->getDoctrineConnection($input->getOption('connection'));
|
||||
|
||||
$params = $connection->getParams();
|
||||
|
||||
$name = isset($params['path']) ? $params['path'] : (isset($params['dbname']) ? $params['dbname'] : false);
|
||||
|
||||
if (!$name) {
|
||||
throw new \InvalidArgumentException("Connection does not contain a 'path' or 'dbname' parameter and cannot be dropped.");
|
||||
}
|
||||
|
||||
if ($input->getOption('force')) {
|
||||
// Only quote if we don't have a path
|
||||
if (!isset($params['path'])) {
|
||||
$name = $connection->getDatabasePlatform()->quoteSingleIdentifier($name);
|
||||
}
|
||||
|
||||
try {
|
||||
$connection->getSchemaManager()->dropDatabase($name);
|
||||
$output->writeln(sprintf('<info>Dropped database for connection named <comment>%s</comment></info>', $name));
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln(sprintf('<error>Could not drop database for connection named <comment>%s</comment></error>', $name));
|
||||
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
|
||||
}
|
||||
} else {
|
||||
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.');
|
||||
$output->writeln('');
|
||||
$output->writeln(sprintf('<info>Would drop the database named <comment>%s</comment>.</info>', $name));
|
||||
$output->writeln('Please run the operation with --force to execute');
|
||||
$output->writeln('<error>All data will be lost!</error>');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Tools\EntityRepositoryGenerator;
|
||||
use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory;
|
||||
|
||||
/**
|
||||
* Generate entity classes from mapping information
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class GenerateEntitiesDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:generate:entities')
|
||||
->setAliases(array('generate:doctrine:entities'))
|
||||
->setDescription('Generates entity classes and method stubs from your mapping information')
|
||||
->addArgument('name', InputArgument::REQUIRED, 'A bundle name, a namespace, or a class name')
|
||||
->addOption('path', null, InputOption::VALUE_REQUIRED, 'The path where to generate entities when it cannot be guessed')
|
||||
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Do not backup existing entities files.')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:generate:entities</info> command generates entity classes
|
||||
and method stubs from your mapping information:
|
||||
|
||||
You have to limit generation of entities:
|
||||
|
||||
* To a bundle:
|
||||
|
||||
<info>php app/console doctrine:generate:entities MyCustomBundle</info>
|
||||
|
||||
* To a single entity:
|
||||
|
||||
<info>php app/console doctrine:generate:entities MyCustomBundle:User</info>
|
||||
<info>php app/console doctrine:generate:entities MyCustomBundle/Entity/User</info>
|
||||
|
||||
* To a namespace
|
||||
|
||||
<info>php app/console doctrine:generate:entities MyCustomBundle/Entity</info>
|
||||
|
||||
If the entities are not stored in a bundle, and if the classes do not exist,
|
||||
the command has no way to guess where they should be generated. In this case,
|
||||
you must provide the <comment>--path</comment> option:
|
||||
|
||||
<info>php app/console doctrine:generate:entities Blog/Entity --path=src/</info>
|
||||
|
||||
By default, the unmodified version of each entity is backed up and saved
|
||||
(e.g. Product.php~). To prevent this task from creating the backup file,
|
||||
pass the <comment>--no-backup</comment> option:
|
||||
|
||||
<info>php app/console doctrine:generate:entities Blog/Entity --no-backup</info>
|
||||
|
||||
<error>Important:</error> Even if you specified Inheritance options in your
|
||||
XML or YAML Mapping files the generator cannot generate the base and
|
||||
child classes for you correctly, because it doesn't know which
|
||||
class is supposed to extend which. You have to adjust the entity
|
||||
code manually for inheritance to work!
|
||||
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine'));
|
||||
|
||||
try {
|
||||
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('name'));
|
||||
|
||||
$output->writeln(sprintf('Generating entities for bundle "<info>%s</info>"', $bundle->getName()));
|
||||
$metadata = $manager->getBundleMetadata($bundle);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$name = strtr($input->getArgument('name'), '/', '\\');
|
||||
|
||||
if (false !== $pos = strpos($name, ':')) {
|
||||
$name = $this->getContainer()->get('doctrine')->getEntityNamespace(substr($name, 0, $pos)).'\\'.substr($name, $pos + 1);
|
||||
}
|
||||
|
||||
if (class_exists($name)) {
|
||||
$output->writeln(sprintf('Generating entity "<info>%s</info>"', $name));
|
||||
$metadata = $manager->getClassMetadata($name, $input->getOption('path'));
|
||||
} else {
|
||||
$output->writeln(sprintf('Generating entities for namespace "<info>%s</info>"', $name));
|
||||
$metadata = $manager->getNamespaceMetadata($name, $input->getOption('path'));
|
||||
}
|
||||
}
|
||||
|
||||
$generator = $this->getEntityGenerator();
|
||||
|
||||
$backupExisting = !$input->getOption('no-backup');
|
||||
$generator->setBackupExisting($backupExisting);
|
||||
|
||||
$repoGenerator = new EntityRepositoryGenerator();
|
||||
foreach ($metadata->getMetadata() as $m) {
|
||||
if ($backupExisting) {
|
||||
$basename = substr($m->name, strrpos($m->name, '\\') + 1);
|
||||
$output->writeln(sprintf(' > backing up <comment>%s.php</comment> to <comment>%s.php~</comment>', $basename, $basename));
|
||||
}
|
||||
// Getting the metadata for the entity class once more to get the correct path if the namespace has multiple occurrences
|
||||
try {
|
||||
$entityMetadata = $manager->getClassMetadata($m->getName(), $input->getOption('path'));
|
||||
} catch (\RuntimeException $e) {
|
||||
// fall back to the bundle metadata when no entity class could be found
|
||||
$entityMetadata = $metadata;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(' > generating <comment>%s</comment>', $m->name));
|
||||
$generator->generate(array($m), $entityMetadata->getPath());
|
||||
|
||||
if ($m->customRepositoryClassName && false !== strpos($m->customRepositoryClassName, $metadata->getNamespace())) {
|
||||
$repoGenerator->writeEntityRepositoryClass($m->customRepositoryClassName, $metadata->getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Mapping\Driver\DatabaseDriver;
|
||||
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
|
||||
use Doctrine\ORM\Tools\Export\ClassMetadataExporter;
|
||||
use Doctrine\ORM\Tools\Console\MetadataFilter;
|
||||
|
||||
/**
|
||||
* Import Doctrine ORM metadata mapping information from an existing database.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class ImportMappingDoctrineCommand extends DoctrineCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:mapping:import')
|
||||
->addArgument('bundle', InputArgument::REQUIRED, 'The bundle to import the mapping information to')
|
||||
->addArgument('mapping-type', InputArgument::OPTIONAL, 'The mapping type to export the imported mapping information to')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->addOption('filter', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A string pattern used to match entities that should be mapped.')
|
||||
->addOption('force', null, InputOption::VALUE_NONE, 'Force to overwrite existing mapping files.')
|
||||
->setDescription('Imports mapping information from an existing database')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:mapping:import</info> command imports mapping information
|
||||
from an existing database:
|
||||
|
||||
<info>php app/console doctrine:mapping:import "MyCustomBundle" xml</info>
|
||||
|
||||
You can also optionally specify which entity manager to import from with the
|
||||
<info>--em</info> option:
|
||||
|
||||
<info>php app/console doctrine:mapping:import "MyCustomBundle" xml --em=default</info>
|
||||
|
||||
If you don't want to map every entity that can be found in the database, use the
|
||||
<info>--filter</info> option. It will try to match the targeted mapped entity with the
|
||||
provided pattern string.
|
||||
|
||||
<info>php app/console doctrine:mapping:import "MyCustomBundle" xml --filter=MyMatchedEntity</info>
|
||||
|
||||
Use the <info>--force</info> option, if you want to override existing mapping files:
|
||||
|
||||
<info>php app/console doctrine:mapping:import "MyCustomBundle" xml --force</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
|
||||
$destPath = $bundle->getPath();
|
||||
$type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml';
|
||||
if ('annotation' === $type) {
|
||||
$destPath .= '/Entity';
|
||||
} else {
|
||||
$destPath .= '/Resources/config/doctrine';
|
||||
}
|
||||
if ('yaml' === $type) {
|
||||
$type = 'yml';
|
||||
}
|
||||
|
||||
$cme = new ClassMetadataExporter();
|
||||
$exporter = $cme->getExporter($type);
|
||||
$exporter->setOverwriteExistingFiles($input->getOption('force'));
|
||||
|
||||
if ('annotation' === $type) {
|
||||
$entityGenerator = $this->getEntityGenerator();
|
||||
$exporter->setEntityGenerator($entityGenerator);
|
||||
}
|
||||
|
||||
$em = $this->getEntityManager($input->getOption('em'));
|
||||
|
||||
$databaseDriver = new DatabaseDriver($em->getConnection()->getSchemaManager());
|
||||
$em->getConfiguration()->setMetadataDriverImpl($databaseDriver);
|
||||
|
||||
$emName = $input->getOption('em');
|
||||
$emName = $emName ? $emName : 'default';
|
||||
|
||||
$cmf = new DisconnectedClassMetadataFactory();
|
||||
$cmf->setEntityManager($em);
|
||||
$metadata = $cmf->getAllMetadata();
|
||||
$metadata = MetadataFilter::filter($metadata, $input->getOption('filter'));
|
||||
if ($metadata) {
|
||||
$output->writeln(sprintf('Importing mapping information from "<info>%s</info>" entity manager', $emName));
|
||||
foreach ($metadata as $class) {
|
||||
$className = $class->name;
|
||||
$class->name = $bundle->getNamespace().'\\Entity\\'.$className;
|
||||
if ('annotation' === $type) {
|
||||
$path = $destPath.'/'.$className.'.php';
|
||||
} else {
|
||||
$path = $destPath.'/'.$className.'.orm.'.$type;
|
||||
}
|
||||
$output->writeln(sprintf(' > writing <comment>%s</comment>', $path));
|
||||
$code = $exporter->exportClassMetadata($class);
|
||||
if (!is_dir($dir = dirname($path))) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
file_put_contents($path, $code);
|
||||
}
|
||||
} else {
|
||||
$output->writeln('Database does not have any mapping information.', 'ERROR');
|
||||
$output->writeln('', 'ERROR');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
|
||||
|
||||
/**
|
||||
* Command to clear the metadata cache of the various cache drivers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-metadata')
|
||||
->setDescription('Clears all metadata cache for a entity manager')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:cache:clear-metadata</info> command clears all metadata
|
||||
cache for the default entity manager:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-metadata</info>
|
||||
|
||||
You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager to clear the cache for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-metadata --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
|
||||
|
||||
/**
|
||||
* Command to clear the query cache of the various cache drivers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class ClearQueryCacheDoctrineCommand extends QueryCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-query')
|
||||
->setDescription('Clears all query cache for a entity manager')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:cache:clear-query</info> command clears all query cache for
|
||||
the default entity manager:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-query</info>
|
||||
|
||||
You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager to clear the cache for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-query --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
|
||||
|
||||
/**
|
||||
* Command to clear the result cache of the various cache drivers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class ClearResultCacheDoctrineCommand extends ResultCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:cache:clear-result')
|
||||
->setDescription('Clears result cache for a entity manager')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:cache:clear-result</info> command clears all result cache
|
||||
for the default entity manager:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result</info>
|
||||
|
||||
You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager to clear the cache for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --em=default</info>
|
||||
|
||||
If you don't want to clear all result cache you can specify some additional
|
||||
options to control what cache is deleted:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --id=cache_key</info>
|
||||
|
||||
Or you can specify a <comment>--regex</comment> to delete cache entries that
|
||||
match it:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --regex="user_(.*)"</info>
|
||||
|
||||
You can also specify a <comment>--prefix</comment> or
|
||||
<comment>--suffix</comment> to delete cache entries for:
|
||||
|
||||
<info>php app/console doctrine:cache:clear-result --prefix="user_" --suffix="_frontend"</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand;
|
||||
use Doctrine\ORM\Tools\Export\Driver\XmlExporter;
|
||||
use Doctrine\ORM\Tools\Export\Driver\YamlExporter;
|
||||
|
||||
/**
|
||||
* Convert Doctrine ORM metadata mapping information between the various supported
|
||||
* formats.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class ConvertMappingDoctrineCommand extends ConvertMappingCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
$this
|
||||
->setName('doctrine:mapping:convert')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:mapping:convert</info> command converts mapping information
|
||||
between supported formats:
|
||||
|
||||
<info>php app/console doctrine:mapping:convert xml /path/to/output</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
||||
|
||||
protected function getExporter($toType, $destPath)
|
||||
{
|
||||
$exporter = parent::getExporter($toType, $destPath);
|
||||
if ($exporter instanceof XmlExporter) {
|
||||
$exporter->setExtension('.orm.xml');
|
||||
} elseif ($exporter instanceof YamlExporter) {
|
||||
$exporter->setExtension('.orm.yml');
|
||||
}
|
||||
|
||||
return $exporter;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
|
||||
|
||||
/**
|
||||
* Command to execute the SQL needed to generate the database schema for
|
||||
* a given entity manager.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class CreateSchemaDoctrineCommand extends CreateCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:create')
|
||||
->setDescription('Executes (or dumps) the SQL needed to generate the database schema')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:schema:create</info> command executes the SQL needed to
|
||||
generate the database schema for the default entity manager:
|
||||
|
||||
<info>php app/console doctrine:schema:create</info>
|
||||
|
||||
You can also generate the database schema for a specific entity manager:
|
||||
|
||||
<info>php app/console doctrine:schema:create --em=default</info>
|
||||
|
||||
Finally, instead of executing the SQL, you can output the SQL:
|
||||
|
||||
<info>php app/console doctrine:schema:create --dump-sql</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
|
||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
||||
|
||||
/**
|
||||
* Provides some helper and convenience methods to configure doctrine commands in the context of bundles
|
||||
* and multiple connections/entity managers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class DoctrineCommandHelper
|
||||
{
|
||||
/**
|
||||
* Convenience method to push the helper sets of a given entity manager into the application.
|
||||
*
|
||||
* @param Application $application
|
||||
* @param string $emName
|
||||
*/
|
||||
static public function setApplicationEntityManager(Application $application, $emName)
|
||||
{
|
||||
$em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName);
|
||||
$helperSet = $application->getHelperSet();
|
||||
$helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
|
||||
$helperSet->set(new EntityManagerHelper($em), 'em');
|
||||
}
|
||||
|
||||
static public function setApplicationConnection(Application $application, $connName)
|
||||
{
|
||||
$connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);
|
||||
$helperSet = $application->getHelperSet();
|
||||
$helperSet->set(new ConnectionHelper($connection), 'db');
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand;
|
||||
|
||||
/**
|
||||
* Command to drop the database schema for a set of classes based on their mappings.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class DropSchemaDoctrineCommand extends DropCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:drop')
|
||||
->setDescription('Executes (or dumps) the SQL needed to drop the current database schema')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:schema:drop</info> command generates the SQL needed to
|
||||
drop the database schema of the default entity manager:
|
||||
|
||||
<info>php app/console doctrine:schema:drop --dump-sql</info>
|
||||
|
||||
Alternatively, you can execute the generated queries:
|
||||
|
||||
<info>php app/console doctrine:schema:drop --force</info>
|
||||
|
||||
You can also optionally specify the name of a entity manager to drop the
|
||||
schema for:
|
||||
|
||||
<info>php app/console doctrine:schema:drop --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand;
|
||||
|
||||
/**
|
||||
* Ensure the Doctrine ORM is configured properly for a production environment.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class EnsureProductionSettingsDoctrineCommand extends EnsureProductionSettingsCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:ensure-production-settings')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:ensure-production-settings</info> command ensures that
|
||||
Doctrine is properly configured for a production environment.:
|
||||
|
||||
<info>php app/console doctrine:ensure-production-settings</info>
|
||||
|
||||
You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager to use:
|
||||
|
||||
<info>php app/console doctrine:ensure-production-settings --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\Tools\Console\Command\InfoCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Show information about mapped entities
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class InfoDoctrineCommand extends InfoCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('doctrine:mapping:info')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setDescription('Shows basic information about all mapped entities')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:mapping:info</info> shows basic information about which
|
||||
entities exist and possibly if their mapping information contains errors or
|
||||
not.
|
||||
|
||||
<info>php app/console doctrine:mapping:info</info>
|
||||
|
||||
If you are using multiple entity managers you can pick your choice with the
|
||||
<info>--em</info> option:
|
||||
|
||||
<info>php app/console doctrine:mapping:info --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
|
||||
|
||||
/**
|
||||
* Execute a Doctrine DQL query and output the results.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class RunDqlDoctrineCommand extends RunDqlCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:query:dql')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:query:dql</info> command executes the given DQL query and
|
||||
outputs the results:
|
||||
|
||||
<info>php app/console doctrine:query:dql "SELECT u FROM UserBundle:User u"</info>
|
||||
|
||||
You can also optional specify some additional options like what type of
|
||||
hydration to use when executing the query:
|
||||
|
||||
<info>php app/console doctrine:query:dql "SELECT u FROM UserBundle:User u" --hydrate=array</info>
|
||||
|
||||
Additionally you can specify the first result and maximum amount of results to
|
||||
show:
|
||||
|
||||
<info>php app/console doctrine:query:dql "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
|
||||
|
||||
/**
|
||||
* Execute a SQL query and output the results.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class RunSqlDoctrineCommand extends RunSqlCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:query:sql')
|
||||
->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:query:sql</info> command executes the given DQL query and
|
||||
outputs the results:
|
||||
|
||||
<info>php app/console doctrine:query:sql "SELECT * from user"</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\Output;
|
||||
use Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand;
|
||||
|
||||
/**
|
||||
* Command to generate the SQL needed to update the database schema to match
|
||||
* the current mapping information.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class UpdateSchemaDoctrineCommand extends UpdateCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:update')
|
||||
->setDescription('Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:schema:update</info> command generates the SQL needed to
|
||||
synchronize the database schema with the current mapping metadata of the
|
||||
default entity manager.
|
||||
|
||||
For example, if you add metadata for a new column to an entity, this command
|
||||
would generate and output the SQL needed to add the new column to the database:
|
||||
|
||||
<info>php app/console doctrine:schema:update --dump-sql</info>
|
||||
|
||||
Alternatively, you can execute the generated queries:
|
||||
|
||||
<info>php app/console doctrine:schema:update --force</info>
|
||||
|
||||
You can also update the database schema for a specific entity manager:
|
||||
|
||||
<info>php app/console doctrine:schema:update --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand as DoctrineValidateSchemaCommand;
|
||||
|
||||
/**
|
||||
* Command to run Doctrine ValidateSchema() on the current mappings.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
* @author Neil Katin <symfony@askneil.com>
|
||||
*/
|
||||
class ValidateSchemaCommand extends DoctrineValidateSchemaCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this
|
||||
->setName('doctrine:schema:validate')
|
||||
->setDescription('Validates the doctrine mapping files')
|
||||
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
|
||||
->setHelp(<<<EOT
|
||||
The <info>doctrine:schema:validate</info> checks the current mappings
|
||||
for valid forward and reverse mappings.
|
||||
|
||||
<info>php app/console doctrine:schema:validate</info>
|
||||
|
||||
You can also optionally specify the <comment>--em</comment> option to specify
|
||||
which entity manager use for the validation.
|
||||
|
||||
<info>php app/console doctrine:schema:validate --em=default</info>
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
}
|
85
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php
vendored
Normal file
85
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ConnectionFactory.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Configuration;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
|
||||
/**
|
||||
* Connection
|
||||
*/
|
||||
class ConnectionFactory
|
||||
{
|
||||
private $typesConfig = array();
|
||||
private $commentedTypes = array();
|
||||
private $initialized = false;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param array $typesConfig
|
||||
*/
|
||||
public function __construct(array $typesConfig)
|
||||
{
|
||||
$this->typesConfig = $typesConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a connection by name.
|
||||
*
|
||||
* @param array $params
|
||||
* @param Configuration $config
|
||||
* @param EventManager $eventManager
|
||||
*
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*/
|
||||
public function createConnection(array $params, Configuration $config = null, EventManager $eventManager = null, array $mappingTypes = array())
|
||||
{
|
||||
if (!$this->initialized) {
|
||||
$this->initializeTypes();
|
||||
$this->initialized = true;
|
||||
}
|
||||
|
||||
$connection = DriverManager::getConnection($params, $config, $eventManager);
|
||||
|
||||
if (!empty($mappingTypes)) {
|
||||
$platform = $connection->getDatabasePlatform();
|
||||
foreach ($mappingTypes as $dbType => $doctrineType) {
|
||||
$platform->registerDoctrineTypeMapping($dbType, $doctrineType);
|
||||
}
|
||||
foreach ($this->commentedTypes as $type) {
|
||||
$platform->markDoctrineTypeCommented(Type::getType($type));
|
||||
}
|
||||
}
|
||||
|
||||
return $connection;
|
||||
}
|
||||
|
||||
private function initializeTypes()
|
||||
{
|
||||
foreach ($this->typesConfig as $type => $typeConfig) {
|
||||
if (Type::hasType($type)) {
|
||||
Type::overrideType($type, $typeConfig['class']);
|
||||
} else {
|
||||
Type::addType($type, $typeConfig['class']);
|
||||
}
|
||||
if ($typeConfig['commented']) {
|
||||
$this->commentedTypes[] = $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
67
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php
vendored
Normal file
67
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Controller/ProfilerController.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Controller;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* ProfilerController.
|
||||
*
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class ProfilerController extends ContainerAware
|
||||
{
|
||||
/**
|
||||
* Renders the profiler panel for the given token.
|
||||
*
|
||||
* @param string $token The profiler token
|
||||
* @param string $connectionName
|
||||
* @param integer $query
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
public function explainAction($token, $connectionName, $query)
|
||||
{
|
||||
$profiler = $this->container->get('profiler');
|
||||
$profiler->disable();
|
||||
|
||||
$profile = $profiler->loadProfile($token);
|
||||
$queries = $profile->getCollector('db')->getQueries();
|
||||
|
||||
if (!isset($queries[$connectionName][$query])) {
|
||||
return new Response('This query does not exist.');
|
||||
}
|
||||
|
||||
$query = $queries[$connectionName][$query];
|
||||
if (!$query['explainable']) {
|
||||
return new Response('This query cannot be explained.');
|
||||
}
|
||||
|
||||
/** @var $connection \Doctrine\DBAL\Connection */
|
||||
$connection = $this->container->get('doctrine')->getConnection($connectionName);
|
||||
try {
|
||||
$results = $connection->executeQuery('EXPLAIN '.$query['sql'], $query['params'], $query['types'])
|
||||
->fetchAll(\PDO::FETCH_ASSOC);
|
||||
} catch (\Exception $e) {
|
||||
return new Response('This query cannot be explained.');
|
||||
}
|
||||
|
||||
return $this->container->get('templating')->renderResponse('DoctrineBundle:Collector:explain.html.twig', array(
|
||||
'data' => $results,
|
||||
'query' => $query,
|
||||
));
|
||||
}
|
||||
}
|
388
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php
vendored
Normal file
388
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DependencyInjection/Configuration.php
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
/**
|
||||
* This class contains the configuration information for the bundle
|
||||
*
|
||||
* This information is solely responsible for how the different configuration
|
||||
* sections are normalized, and merged.
|
||||
*
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Boolean $debug Whether to use the debug mode
|
||||
*/
|
||||
public function __construct($debug)
|
||||
{
|
||||
$this->debug = (Boolean) $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree builder.
|
||||
*
|
||||
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('doctrine');
|
||||
|
||||
$this->addDbalSection($rootNode);
|
||||
$this->addOrmSection($rootNode);
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
private function addDbalSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('dbal')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return is_array($v) && !array_key_exists('connections', $v) && !array_key_exists('connection', $v); })
|
||||
->then(function ($v) {
|
||||
// Key that should not be rewritten to the connection config
|
||||
$excludedKeys = array('default_connection' => true, 'types' => true, 'type' => true);
|
||||
$connection = array();
|
||||
foreach ($v as $key => $value) {
|
||||
if (isset($excludedKeys[$key])) {
|
||||
continue;
|
||||
}
|
||||
$connection[$key] = $v[$key];
|
||||
unset($v[$key]);
|
||||
}
|
||||
$v['default_connection'] = isset($v['default_connection']) ? (string) $v['default_connection'] : 'default';
|
||||
$v['connections'] = array($v['default_connection'] => $connection);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('default_connection')->end()
|
||||
->end()
|
||||
->fixXmlConfig('type')
|
||||
->children()
|
||||
->arrayNode('types')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array('class' => $v); })
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('class')->isRequired()->end()
|
||||
->booleanNode('commented')->defaultTrue()->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->fixXmlConfig('connection')
|
||||
->append($this->getDbalConnectionsNode())
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function getDbalConnectionsNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$node = $treeBuilder->root('connections');
|
||||
|
||||
/** @var $connectionNode ArrayNodeDefinition */
|
||||
$connectionNode = $node
|
||||
->requiresAtLeastOneElement()
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
;
|
||||
|
||||
$this->configureDbalDriverNode($connectionNode);
|
||||
|
||||
$connectionNode
|
||||
->fixXmlConfig('option')
|
||||
->fixXmlConfig('mapping_type')
|
||||
->fixXmlConfig('slave')
|
||||
->children()
|
||||
->scalarNode('driver')->defaultValue('pdo_mysql')->end()
|
||||
->scalarNode('platform_service')->end()
|
||||
->booleanNode('logging')->defaultValue($this->debug)->end()
|
||||
->booleanNode('profiling')->defaultValue($this->debug)->end()
|
||||
->scalarNode('driver_class')->end()
|
||||
->scalarNode('wrapper_class')->end()
|
||||
->arrayNode('options')
|
||||
->useAttributeAsKey('key')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->arrayNode('mapping_types')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
$slaveNode = $connectionNode
|
||||
->children()
|
||||
->arrayNode('slaves')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
;
|
||||
$this->configureDbalDriverNode($slaveNode);
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds config keys related to params processed by the DBAL drivers
|
||||
*
|
||||
* These keys are available for slave configurations too.
|
||||
*
|
||||
* @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $node
|
||||
*/
|
||||
private function configureDbalDriverNode(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->scalarNode('dbname')->end()
|
||||
->scalarNode('host')->defaultValue('localhost')->end()
|
||||
->scalarNode('port')->defaultNull()->end()
|
||||
->scalarNode('user')->defaultValue('root')->end()
|
||||
->scalarNode('password')->defaultNull()->end()
|
||||
->scalarNode('charset')->end()
|
||||
->scalarNode('path')->end()
|
||||
->booleanNode('memory')->end()
|
||||
->scalarNode('unix_socket')->info('The unix socket to use for MySQL')->end()
|
||||
->booleanNode('persistent')->info('True to use as persistent connection for the ibm_db2 driver')->end()
|
||||
->scalarNode('protocol')->info('The protocol to use for the ibm_db2 driver (default to TCPIP if ommited)')->end()
|
||||
->booleanNode('service')->info('True to use dbname as service name instead of SID for Oracle')->end()
|
||||
->scalarNode('sessionMode')
|
||||
->info('The session mode to use for the oci8 driver')
|
||||
->end()
|
||||
->booleanNode('pooled')->info('True to use a pooled server with the oci8 driver')->end()
|
||||
->booleanNode('MultipleActiveResultSets')->info('Configuring MultipleActiveResultSets for the pdo_sqlsrv driver')->end()
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function($v) {return !isset($v['sessionMode']) && isset($v['session_mode']);})
|
||||
->then(function($v) {
|
||||
$v['sessionMode'] = $v['session_mode'];
|
||||
unset($v['session_mode']);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function($v) {return !isset($v['MultipleActiveResultSets']) && isset($v['multiple_active_result_sets']);})
|
||||
->then(function($v) {
|
||||
$v['MultipleActiveResultSets'] = $v['multiple_active_result_sets'];
|
||||
unset($v['multiple_active_result_sets']);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function addOrmSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('orm')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return null === $v || (is_array($v) && !array_key_exists('entity_managers', $v) && !array_key_exists('entity_manager', $v)); })
|
||||
->then(function ($v) {
|
||||
$v = (array) $v;
|
||||
// Key that should not be rewritten to the connection config
|
||||
$excludedKeys = array(
|
||||
'default_entity_manager' => true, 'auto_generate_proxy_classes' => true,
|
||||
'proxy_dir' => true, 'proxy_namespace' => true, 'resolve_target_entities' => true,
|
||||
'resolve_target_entity' => true,
|
||||
);
|
||||
$entityManager = array();
|
||||
foreach ($v as $key => $value) {
|
||||
if (isset($excludedKeys[$key])) {
|
||||
continue;
|
||||
}
|
||||
$entityManager[$key] = $v[$key];
|
||||
unset($v[$key]);
|
||||
}
|
||||
$v['default_entity_manager'] = isset($v['default_entity_manager']) ? (string) $v['default_entity_manager'] : 'default';
|
||||
$v['entity_managers'] = array($v['default_entity_manager'] => $entityManager);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('default_entity_manager')->end()
|
||||
->booleanNode('auto_generate_proxy_classes')->defaultFalse()->end()
|
||||
->scalarNode('proxy_dir')->defaultValue('%kernel.cache_dir%/doctrine/orm/Proxies')->end()
|
||||
->scalarNode('proxy_namespace')->defaultValue('Proxies')->end()
|
||||
->end()
|
||||
->fixXmlConfig('entity_manager')
|
||||
->append($this->getOrmEntityManagersNode())
|
||||
->fixXmlConfig('resolve_target_entity', 'resolve_target_entities')
|
||||
->append($this->getOrmTargetEntityResolverNode())
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function getOrmTargetEntityResolverNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$node = $treeBuilder->root('resolve_target_entities');
|
||||
|
||||
$node
|
||||
->useAttributeAsKey('interface')
|
||||
->prototype('scalar')
|
||||
->cannotBeEmpty()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function getOrmEntityManagersNode()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$node = $treeBuilder->root('entity_managers');
|
||||
|
||||
$node
|
||||
->requiresAtLeastOneElement()
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->addDefaultsIfNotSet()
|
||||
->append($this->getOrmCacheDriverNode('query_cache_driver'))
|
||||
->append($this->getOrmCacheDriverNode('metadata_cache_driver'))
|
||||
->append($this->getOrmCacheDriverNode('result_cache_driver'))
|
||||
->children()
|
||||
->scalarNode('connection')->end()
|
||||
->scalarNode('class_metadata_factory_name')->defaultValue('Doctrine\ORM\Mapping\ClassMetadataFactory')->end()
|
||||
->scalarNode('default_repository_class')->defaultValue('Doctrine\ORM\EntityRepository')->end()
|
||||
->scalarNode('auto_mapping')->defaultFalse()->end()
|
||||
->end()
|
||||
->fixXmlConfig('hydrator')
|
||||
->children()
|
||||
->arrayNode('hydrators')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->end()
|
||||
->fixXmlConfig('mapping')
|
||||
->children()
|
||||
->arrayNode('mappings')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array('type' => $v); })
|
||||
->end()
|
||||
->treatNullLike(array())
|
||||
->treatFalseLike(array('mapping' => false))
|
||||
->performNoDeepMerging()
|
||||
->children()
|
||||
->scalarNode('mapping')->defaultValue(true)->end()
|
||||
->scalarNode('type')->end()
|
||||
->scalarNode('dir')->end()
|
||||
->scalarNode('alias')->end()
|
||||
->scalarNode('prefix')->end()
|
||||
->booleanNode('is_bundle')->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('dql')
|
||||
->fixXmlConfig('string_function')
|
||||
->fixXmlConfig('numeric_function')
|
||||
->fixXmlConfig('datetime_function')
|
||||
->children()
|
||||
->arrayNode('string_functions')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->arrayNode('numeric_functions')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->arrayNode('datetime_functions')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->fixXmlConfig('filter')
|
||||
->children()
|
||||
->arrayNode('filters')
|
||||
->info('Register SQL Filters in the entity manager')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array('class' => $v); })
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
// The content of the XML node is returned as the "value" key so we need to rename it
|
||||
->ifTrue(function($v) {return is_array($v) && isset($v['value']); })
|
||||
->then(function($v) {
|
||||
$v['class'] = $v['value'];
|
||||
unset($v['value']);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('class')->isRequired()->end()
|
||||
->booleanNode('enabled')->defaultFalse()->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function getOrmCacheDriverNode($name)
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$node = $treeBuilder->root($name);
|
||||
|
||||
$node
|
||||
->addDefaultsIfNotSet()
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array('type' => $v); })
|
||||
->end()
|
||||
->children()
|
||||
->scalarNode('type')->defaultValue('array')->end()
|
||||
->scalarNode('host')->end()
|
||||
->scalarNode('port')->end()
|
||||
->scalarNode('instance_class')->end()
|
||||
->scalarNode('class')->end()
|
||||
->scalarNode('id')->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
}
|
@@ -0,0 +1,437 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\DefinitionDecorator;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
/**
|
||||
* DoctrineExtension is an extension for the Doctrine DBAL and ORM library.
|
||||
*
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class DoctrineExtension extends AbstractDoctrineExtension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
if (!empty($config['dbal'])) {
|
||||
$this->dbalLoad($config['dbal'], $container);
|
||||
}
|
||||
|
||||
if (!empty($config['orm'])) {
|
||||
$this->ormLoad($config['orm'], $container);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the DBAL configuration.
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
* <doctrine:dbal id="myconn" dbname="sfweb" user="root" />
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function dbalLoad(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('dbal.xml');
|
||||
|
||||
if (empty($config['default_connection'])) {
|
||||
$keys = array_keys($config['connections']);
|
||||
$config['default_connection'] = reset($keys);
|
||||
}
|
||||
$this->defaultConnection = $config['default_connection'];
|
||||
|
||||
$container->setAlias('database_connection', sprintf('doctrine.dbal.%s_connection', $this->defaultConnection));
|
||||
$container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $this->defaultConnection), false));
|
||||
|
||||
$container->setParameter('doctrine.dbal.connection_factory.types', $config['types']);
|
||||
|
||||
$connections = array();
|
||||
foreach (array_keys($config['connections']) as $name) {
|
||||
$connections[$name] = sprintf('doctrine.dbal.%s_connection', $name);
|
||||
}
|
||||
$container->setParameter('doctrine.connections', $connections);
|
||||
$container->setParameter('doctrine.default_connection', $this->defaultConnection);
|
||||
|
||||
foreach ($config['connections'] as $name => $connection) {
|
||||
$this->loadDbalConnection($name, $connection, $container);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a configured DBAL connection.
|
||||
*
|
||||
* @param string $name The name of the connection
|
||||
* @param array $connection A dbal connection configuration.
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadDbalConnection($name, array $connection, ContainerBuilder $container)
|
||||
{
|
||||
// configuration
|
||||
$configuration = $container->setDefinition(sprintf('doctrine.dbal.%s_connection.configuration', $name), new DefinitionDecorator('doctrine.dbal.connection.configuration'));
|
||||
$logger = null;
|
||||
if ($connection['logging']) {
|
||||
$logger = new Reference('doctrine.dbal.logger');
|
||||
}
|
||||
unset ($connection['logging']);
|
||||
if ($connection['profiling']) {
|
||||
$profilingLoggerId = 'doctrine.dbal.logger.profiling.'.$name;
|
||||
$container->setDefinition($profilingLoggerId, new DefinitionDecorator('doctrine.dbal.logger.profiling'));
|
||||
$logger = new Reference($profilingLoggerId);
|
||||
$container->getDefinition('data_collector.doctrine')->addMethodCall('addLogger', array($name, $logger));
|
||||
|
||||
if (null !== $logger) {
|
||||
$chainLogger = new DefinitionDecorator('doctrine.dbal.logger.chain');
|
||||
$chainLogger->addMethodCall('addLogger', array($logger));
|
||||
|
||||
$loggerId = 'doctrine.dbal.logger.chain.'.$name;
|
||||
$container->setDefinition($loggerId, $chainLogger);
|
||||
$logger = new Reference($loggerId);
|
||||
}
|
||||
}
|
||||
unset($connection['profiling']);
|
||||
|
||||
if ($logger) {
|
||||
$configuration->addMethodCall('setSQLLogger', array($logger));
|
||||
}
|
||||
|
||||
// event manager
|
||||
$def = $container->setDefinition(sprintf('doctrine.dbal.%s_connection.event_manager', $name), new DefinitionDecorator('doctrine.dbal.connection.event_manager'));
|
||||
|
||||
// connection
|
||||
if (isset($connection['charset'])) {
|
||||
if ((isset($connection['driver']) && stripos($connection['driver'], 'mysql') !== false) ||
|
||||
(isset($connection['driver_class']) && stripos($connection['driver_class'], 'mysql') !== false)) {
|
||||
$mysqlSessionInit = new Definition('%doctrine.dbal.events.mysql_session_init.class%');
|
||||
$mysqlSessionInit->setArguments(array($connection['charset']));
|
||||
$mysqlSessionInit->setPublic(false);
|
||||
$mysqlSessionInit->addTag('doctrine.event_subscriber', array('connection' => $name));
|
||||
|
||||
$container->setDefinition(
|
||||
sprintf('doctrine.dbal.%s_connection.events.mysqlsessioninit', $name),
|
||||
$mysqlSessionInit
|
||||
);
|
||||
unset($connection['charset']);
|
||||
}
|
||||
}
|
||||
|
||||
$options = $this->getConnectionOptions($connection);
|
||||
|
||||
$container
|
||||
->setDefinition(sprintf('doctrine.dbal.%s_connection', $name), new DefinitionDecorator('doctrine.dbal.connection'))
|
||||
->setArguments(array(
|
||||
$options,
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.configuration', $name)),
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.event_manager', $name)),
|
||||
$connection['mapping_types'],
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
protected function getConnectionOptions($connection)
|
||||
{
|
||||
$options = $connection;
|
||||
|
||||
if (isset($options['platform_service'])) {
|
||||
$options['platform'] = new Reference($options['platform_service']);
|
||||
unset($options['platform_service']);
|
||||
}
|
||||
unset($options['mapping_types']);
|
||||
|
||||
foreach (array(
|
||||
'options' => 'driverOptions',
|
||||
'driver_class' => 'driverClass',
|
||||
'wrapper_class' => 'wrapperClass',
|
||||
) as $old => $new) {
|
||||
if (isset($options[$old])) {
|
||||
$options[$new] = $options[$old];
|
||||
unset($options[$old]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($options['slaves'])) {
|
||||
$nonRewrittenKeys = array(
|
||||
'driver' => true, 'driverOptions' => true, 'driverClass' => true, 'wrapperClass' => true,
|
||||
'platform' => true, 'slaves' => true, 'master' => true,
|
||||
// included by safety but should have been unset already
|
||||
'logging' => true, 'profiling' => true, 'mapping_types' => true, 'platform_service' => true,
|
||||
);
|
||||
foreach ($options as $key => $value) {
|
||||
if (isset($nonRewrittenKeys[$key])) {
|
||||
continue;
|
||||
}
|
||||
$options['master'][$key] = $value;
|
||||
unset($options[$key]);
|
||||
}
|
||||
if (empty($options['wrapperClass'])) {
|
||||
// Change the wrapper class only if the user does not already forced using a custom one.
|
||||
$options['wrapperClass'] = 'Doctrine\\DBAL\\Connections\\MasterSlaveConnection';
|
||||
}
|
||||
} else {
|
||||
unset($options['slaves']);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the Doctrine ORM configuration.
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
* <doctrine:orm id="mydm" connection="myconn" />
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function ormLoad(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('orm.xml');
|
||||
|
||||
$this->entityManagers = array();
|
||||
foreach (array_keys($config['entity_managers']) as $name) {
|
||||
$this->entityManagers[$name] = sprintf('doctrine.orm.%s_entity_manager', $name);
|
||||
}
|
||||
$container->setParameter('doctrine.entity_managers', $this->entityManagers);
|
||||
|
||||
if (empty($config['default_entity_manager'])) {
|
||||
$tmp = array_keys($this->entityManagers);
|
||||
$config['default_entity_manager'] = reset($tmp);
|
||||
}
|
||||
$container->setParameter('doctrine.default_entity_manager', $config['default_entity_manager']);
|
||||
|
||||
$options = array('auto_generate_proxy_classes', 'proxy_dir', 'proxy_namespace');
|
||||
foreach ($options as $key) {
|
||||
$container->setParameter('doctrine.orm.'.$key, $config[$key]);
|
||||
}
|
||||
|
||||
$container->setAlias('doctrine.orm.entity_manager', sprintf('doctrine.orm.%s_entity_manager', $config['default_entity_manager']));
|
||||
|
||||
foreach ($config['entity_managers'] as $name => $entityManager) {
|
||||
$entityManager['name'] = $name;
|
||||
$this->loadOrmEntityManager($entityManager, $container);
|
||||
}
|
||||
|
||||
if ($config['resolve_target_entities']) {
|
||||
$def = $container->findDefinition('doctrine.orm.listeners.resolve_target_entity');
|
||||
foreach ($config['resolve_target_entities'] as $name => $implementation) {
|
||||
$def->addMethodCall('addResolveTargetEntity', array(
|
||||
$name, $implementation, array()
|
||||
));
|
||||
}
|
||||
|
||||
$def->addTag('doctrine.event_listener', array('event' => 'loadClassMetadata'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a configured ORM entity manager.
|
||||
*
|
||||
* @param array $entityManager A configured ORM entity manager.
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadOrmEntityManager(array $entityManager, ContainerBuilder $container)
|
||||
{
|
||||
if ($entityManager['auto_mapping'] && count($this->entityManagers) > 1) {
|
||||
throw new \LogicException('You cannot enable "auto_mapping" when several entity managers are defined.');
|
||||
}
|
||||
|
||||
$ormConfigDef = $container->setDefinition(sprintf('doctrine.orm.%s_configuration', $entityManager['name']), new DefinitionDecorator('doctrine.orm.configuration'));
|
||||
|
||||
$this->loadOrmEntityManagerMappingInformation($entityManager, $ormConfigDef, $container);
|
||||
$this->loadOrmCacheDrivers($entityManager, $container);
|
||||
|
||||
$methods = array(
|
||||
'setMetadataCacheImpl' => new Reference(sprintf('doctrine.orm.%s_metadata_cache', $entityManager['name'])),
|
||||
'setQueryCacheImpl' => new Reference(sprintf('doctrine.orm.%s_query_cache', $entityManager['name'])),
|
||||
'setResultCacheImpl' => new Reference(sprintf('doctrine.orm.%s_result_cache', $entityManager['name'])),
|
||||
'setMetadataDriverImpl' => new Reference('doctrine.orm.'.$entityManager['name'].'_metadata_driver'),
|
||||
'setProxyDir' => '%doctrine.orm.proxy_dir%',
|
||||
'setProxyNamespace' => '%doctrine.orm.proxy_namespace%',
|
||||
'setAutoGenerateProxyClasses' => '%doctrine.orm.auto_generate_proxy_classes%',
|
||||
'setClassMetadataFactoryName' => $entityManager['class_metadata_factory_name'],
|
||||
'setDefaultRepositoryClassName' => $entityManager['default_repository_class'],
|
||||
);
|
||||
foreach ($methods as $method => $arg) {
|
||||
$ormConfigDef->addMethodCall($method, array($arg));
|
||||
}
|
||||
|
||||
foreach ($entityManager['hydrators'] as $name => $class) {
|
||||
$ormConfigDef->addMethodCall('addCustomHydrationMode', array($name, $class));
|
||||
}
|
||||
|
||||
if (!empty($entityManager['dql'])) {
|
||||
foreach ($entityManager['dql']['string_functions'] as $name => $function) {
|
||||
$ormConfigDef->addMethodCall('addCustomStringFunction', array($name, $function));
|
||||
}
|
||||
foreach ($entityManager['dql']['numeric_functions'] as $name => $function) {
|
||||
$ormConfigDef->addMethodCall('addCustomNumericFunction', array($name, $function));
|
||||
}
|
||||
foreach ($entityManager['dql']['datetime_functions'] as $name => $function) {
|
||||
$ormConfigDef->addMethodCall('addCustomDatetimeFunction', array($name, $function));
|
||||
}
|
||||
}
|
||||
|
||||
$enabledFilters = array();
|
||||
foreach ($entityManager['filters'] as $name => $filter) {
|
||||
$ormConfigDef->addMethodCall('addFilter', array($name, $filter['class']));
|
||||
if ($filter['enabled']) {
|
||||
$enabledFilters[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
$managerConfiguratorName = sprintf('doctrine.orm.%s_manager_configurator', $entityManager['name']);
|
||||
$managerConfiguratorDef = $container
|
||||
->setDefinition($managerConfiguratorName, new DefinitionDecorator('doctrine.orm.manager_configurator.abstract'))
|
||||
->replaceArgument(0, $enabledFilters)
|
||||
;
|
||||
|
||||
if (!isset($entityManager['connection'])) {
|
||||
$entityManager['connection'] = $this->defaultConnection;
|
||||
}
|
||||
|
||||
$container
|
||||
->setDefinition(sprintf('doctrine.orm.%s_entity_manager', $entityManager['name']), new DefinitionDecorator('doctrine.orm.entity_manager.abstract'))
|
||||
->setArguments(array(
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection', $entityManager['connection'])),
|
||||
new Reference(sprintf('doctrine.orm.%s_configuration', $entityManager['name']))
|
||||
))
|
||||
->setConfigurator(array(new Reference($managerConfiguratorName), 'configure'))
|
||||
;
|
||||
|
||||
$container->setAlias(
|
||||
sprintf('doctrine.orm.%s_entity_manager.event_manager', $entityManager['name']),
|
||||
new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $entityManager['connection']), false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an ORM entity managers bundle mapping information.
|
||||
*
|
||||
* There are two distinct configuration possibilities for mapping information:
|
||||
*
|
||||
* 1. Specify a bundle and optionally details where the entity and mapping information reside.
|
||||
* 2. Specify an arbitrary mapping location.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* doctrine.orm:
|
||||
* mappings:
|
||||
* MyBundle1: ~
|
||||
* MyBundle2: yml
|
||||
* MyBundle3: { type: annotation, dir: Entities/ }
|
||||
* MyBundle4: { type: xml, dir: Resources/config/doctrine/mapping }
|
||||
* MyBundle5:
|
||||
* type: yml
|
||||
* dir: [bundle-mappings1/, bundle-mappings2/]
|
||||
* alias: BundleAlias
|
||||
* arbitrary_key:
|
||||
* type: xml
|
||||
* dir: %kernel.dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Entities
|
||||
* prefix: DoctrineExtensions\Entities\
|
||||
* alias: DExt
|
||||
*
|
||||
* In the case of bundles everything is really optional (which leads to autodetection for this bundle) but
|
||||
* in the mappings key everything except alias is a required argument.
|
||||
*
|
||||
* @param array $entityManager A configured ORM entity manager
|
||||
* @param Definition $ormConfigDef A Definition instance
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadOrmEntityManagerMappingInformation(array $entityManager, Definition $ormConfigDef, ContainerBuilder $container)
|
||||
{
|
||||
// reset state of drivers and alias map. They are only used by this methods and children.
|
||||
$this->drivers = array();
|
||||
$this->aliasMap = array();
|
||||
|
||||
$this->loadMappingInformation($entityManager, $container);
|
||||
$this->registerMappingDrivers($entityManager, $container);
|
||||
|
||||
$ormConfigDef->addMethodCall('setEntityNamespaces', array($this->aliasMap));
|
||||
}
|
||||
|
||||
protected function getObjectManagerElementName($name)
|
||||
{
|
||||
return 'doctrine.orm.'.$name;
|
||||
}
|
||||
|
||||
protected function getMappingObjectDefaultName()
|
||||
{
|
||||
return 'Entity';
|
||||
}
|
||||
|
||||
protected function getMappingResourceConfigDirectory()
|
||||
{
|
||||
return 'Resources/config/doctrine';
|
||||
}
|
||||
|
||||
protected function getMappingResourceExtension()
|
||||
{
|
||||
return 'orm';
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a configured entity managers cache drivers.
|
||||
*
|
||||
* @param array $entityManager A configured ORM entity manager.
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadOrmCacheDrivers(array $entityManager, ContainerBuilder $container)
|
||||
{
|
||||
$this->loadObjectManagerCacheDriver($entityManager, $container, 'metadata_cache');
|
||||
$this->loadObjectManagerCacheDriver($entityManager, $container, 'result_cache');
|
||||
$this->loadObjectManagerCacheDriver($entityManager, $container, 'query_cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base path for the XSD files.
|
||||
*
|
||||
* @return string The XSD base path
|
||||
*/
|
||||
public function getXsdValidationBasePath()
|
||||
{
|
||||
return __DIR__.'/../Resources/config/schema';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace to be used for this extension (XML namespace).
|
||||
*
|
||||
* @return string The XML namespace
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return 'http://symfony.com/schema/dic/doctrine';
|
||||
}
|
||||
|
||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||
{
|
||||
return new Configuration($container->getParameter('kernel.debug'));
|
||||
}
|
||||
}
|
120
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php
vendored
Normal file
120
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle;
|
||||
|
||||
use Doctrine\Common\Util\ClassUtils;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
|
||||
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\RunSqlDoctrineCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\Security\UserProvider\EntityFactory;
|
||||
|
||||
/**
|
||||
* Bundle.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com>
|
||||
*/
|
||||
class DoctrineBundle extends Bundle
|
||||
{
|
||||
private $autoloader;
|
||||
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->addCompilerPass(new RegisterEventListenersAndSubscribersPass('doctrine.connections', 'doctrine.dbal.%s_connection.event_manager', 'doctrine'), PassConfig::TYPE_BEFORE_OPTIMIZATION);
|
||||
|
||||
if ($container->hasExtension('security')) {
|
||||
$container->getExtension('security')->addUserProviderFactory(new EntityFactory('entity', 'doctrine.orm.security.user.provider'));
|
||||
}
|
||||
$container->addCompilerPass(new DoctrineValidationPass('orm'));
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
// Register an autoloader for proxies to avoid issues when unserializing them
|
||||
// when the ORM is used.
|
||||
if ($this->container->hasParameter('doctrine.orm.proxy_namespace')) {
|
||||
$namespace = $this->container->getParameter('doctrine.orm.proxy_namespace');
|
||||
$dir = $this->container->getParameter('doctrine.orm.proxy_dir');
|
||||
// See https://github.com/symfony/symfony/pull/3419 for usage of
|
||||
// references
|
||||
$container =& $this->container;
|
||||
|
||||
$this->autoloader = function($class) use ($namespace, $dir, &$container) {
|
||||
if (0 === strpos($class, $namespace)) {
|
||||
$fileName = str_replace('\\', '', substr($class, strlen($namespace) +1));
|
||||
$file = $dir.DIRECTORY_SEPARATOR.$fileName.'.php';
|
||||
|
||||
if (!is_file($file) && $container->getParameter('kernel.debug')) {
|
||||
$originalClassName = ClassUtils::getRealClass($class);
|
||||
$registry = $container->get('doctrine');
|
||||
|
||||
// Tries to auto-generate the proxy file
|
||||
foreach ($registry->getManagers() as $em) {
|
||||
|
||||
if ($em->getConfiguration()->getAutoGenerateProxyClasses()) {
|
||||
$classes = $em->getMetadataFactory()->getAllMetadata();
|
||||
|
||||
foreach ($classes as $classMetadata) {
|
||||
if ($classMetadata->name == $originalClassName) {
|
||||
$em->getProxyFactory()->generateProxyClasses(array($classMetadata));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearstatcache($file);
|
||||
}
|
||||
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
};
|
||||
spl_autoload_register($this->autoloader);
|
||||
}
|
||||
}
|
||||
|
||||
public function shutdown()
|
||||
{
|
||||
if (null !== $this->autoloader) {
|
||||
spl_autoload_unregister($this->autoloader);
|
||||
$this->autoloader = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function registerCommands(Application $application)
|
||||
{
|
||||
// Use the default logic when the ORM is available.
|
||||
// This avoids listing all ORM commands by hand.
|
||||
if (class_exists('Doctrine\\ORM\\Version')) {
|
||||
parent::registerCommands($application);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Register only the DBAL commands if the ORM is not available.
|
||||
$application->add(new CreateDatabaseDoctrineCommand());
|
||||
$application->add(new DropDatabaseDoctrineCommand());
|
||||
$application->add(new RunSqlDoctrineCommand());
|
||||
}
|
||||
}
|
13
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/LICENSE
vendored
Normal file
13
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/LICENSE
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2011 Fabien Potencier, Doctrine Project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
59
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php
vendored
Normal file
59
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/ManagerConfigurator.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Configurator for an EntityManager
|
||||
*
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class ManagerConfigurator
|
||||
{
|
||||
private $enabledFilters = array();
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param array $enabledFilters
|
||||
*/
|
||||
public function __construct(array $enabledFilters)
|
||||
{
|
||||
$this->enabledFilters = $enabledFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a connection by name.
|
||||
*
|
||||
* @param EntityManager $entityManager
|
||||
*/
|
||||
public function configure(EntityManager $entityManager)
|
||||
{
|
||||
$this->enableFilters($entityManager);
|
||||
}
|
||||
|
||||
private function enableFilters(EntityManager $entityManager)
|
||||
{
|
||||
if (empty($this->enabledFilters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$filterCollection = $entityManager->getFilters();
|
||||
foreach ($this->enabledFilters as $filter) {
|
||||
$filterCollection->enable($filter);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Mapping;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ClassMetadataCollection
|
||||
{
|
||||
private $path;
|
||||
private $namespace;
|
||||
private $metadata;
|
||||
|
||||
public function __construct(array $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
}
|
||||
|
||||
public function getNamespace()
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Mapping;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class DisconnectedMetadataFactory extends MetadataFactory
|
||||
{
|
||||
protected function getClassMetadataFactoryClass()
|
||||
{
|
||||
return 'Doctrine\\ORM\\Tools\\DisconnectedClassMetadataFactory';
|
||||
}
|
||||
}
|
180
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php
vendored
Normal file
180
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Mapping/MetadataFactory.php
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Mapping;
|
||||
|
||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
|
||||
/**
|
||||
* This class provides methods to access Doctrine entity class metadata for a
|
||||
* given bundle, namespace or entity class.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class MetadataFactory
|
||||
{
|
||||
private $registry;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ManagerRegistry $registry A ManagerRegistry instance
|
||||
*/
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of all classes of a bundle.
|
||||
*
|
||||
* @param BundleInterface $bundle A BundleInterface instance
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
*/
|
||||
public function getBundleMetadata(BundleInterface $bundle)
|
||||
{
|
||||
$namespace = $bundle->getNamespace();
|
||||
$metadata = $this->getMetadataForNamespace($namespace);
|
||||
if (!$metadata->getMetadata()) {
|
||||
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundle->getName()));
|
||||
}
|
||||
|
||||
$path = $this->getBasePathForClass($bundle->getName(), $bundle->getNamespace(), $bundle->getPath());
|
||||
|
||||
$metadata->setPath($path);
|
||||
$metadata->setNamespace($bundle->getNamespace());
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of a class.
|
||||
*
|
||||
* @param string $class A class name
|
||||
* @param string $path The path where the class is stored (if known)
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
*/
|
||||
public function getClassMetadata($class, $path = null)
|
||||
{
|
||||
$metadata = $this->getMetadataForClass($class);
|
||||
if (!$metadata->getMetadata()) {
|
||||
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($class);
|
||||
}
|
||||
|
||||
$this->findNamespaceAndPathForMetadata($metadata);
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata of all classes of a namespace.
|
||||
*
|
||||
* @param string $namespace A namespace name
|
||||
* @param string $path The path where the class is stored (if known)
|
||||
*
|
||||
* @return ClassMetadataCollection A ClassMetadataCollection instance
|
||||
*/
|
||||
public function getNamespaceMetadata($namespace, $path = null)
|
||||
{
|
||||
$metadata = $this->getMetadataForNamespace($namespace);
|
||||
if (!$metadata->getMetadata()) {
|
||||
throw new \RuntimeException(sprintf('Namespace "%s" does not contain any mapped entities.', $namespace));
|
||||
}
|
||||
|
||||
$this->findNamespaceAndPathForMetadata($metadata, $path);
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find and configure path and namespace for the metadata collection.
|
||||
*
|
||||
* @param ClassMetadataCollection $metadata
|
||||
* @param string|null $path
|
||||
* @return void
|
||||
*/
|
||||
public function findNamespaceAndPathForMetadata(ClassMetadataCollection $metadata, $path = null)
|
||||
{
|
||||
$all = $metadata->getMetadata();
|
||||
if (class_exists($all[0]->name)) {
|
||||
$r = new \ReflectionClass($all[0]->name);
|
||||
$path = $this->getBasePathForClass($r->getName(), $r->getNamespaceName(), dirname($r->getFilename()));
|
||||
} elseif (!$path) {
|
||||
throw new \RuntimeException(sprintf('Unable to determine where to save the "%s" class (use the --path option).', $all[0]->name));
|
||||
}
|
||||
|
||||
$metadata->setPath($path);
|
||||
$metadata->setNamespace(isset($r) ? $r->getNamespaceName() : $all[0]->name);
|
||||
}
|
||||
|
||||
private function getBasePathForClass($name, $namespace, $path)
|
||||
{
|
||||
$namespace = str_replace('\\', '/', $namespace);
|
||||
$search = str_replace('\\', '/', $path);
|
||||
$destination = str_replace('/'.$namespace, '', $search, $c);
|
||||
|
||||
if ($c != 1) {
|
||||
throw new \RuntimeException(sprintf('Can\'t find base path for "%s" (path: "%s", destination: "%s").', $name, $path, $destination));
|
||||
}
|
||||
|
||||
return $destination;
|
||||
}
|
||||
|
||||
private function getMetadataForNamespace($namespace)
|
||||
{
|
||||
$metadata = array();
|
||||
foreach ($this->getAllMetadata() as $m) {
|
||||
if (strpos($m->name, $namespace) === 0) {
|
||||
$metadata[] = $m;
|
||||
}
|
||||
}
|
||||
|
||||
return new ClassMetadataCollection($metadata);
|
||||
}
|
||||
|
||||
private function getMetadataForClass($entity)
|
||||
{
|
||||
foreach ($this->getAllMetadata() as $metadata) {
|
||||
if ($metadata->name === $entity) {
|
||||
return new ClassMetadataCollection(array($metadata));
|
||||
}
|
||||
}
|
||||
|
||||
return new ClassMetadataCollection(array());
|
||||
}
|
||||
|
||||
private function getAllMetadata()
|
||||
{
|
||||
$metadata = array();
|
||||
foreach ($this->registry->getManagers() as $em) {
|
||||
$class = $this->getClassMetadataFactoryClass();
|
||||
$cmf = new $class();
|
||||
$cmf->setEntityManager($em);
|
||||
foreach ($cmf->getAllMetadata() as $m) {
|
||||
$metadata[] = $m;
|
||||
}
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
protected function getClassMetadataFactoryClass()
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\ClassMetadataFactory';
|
||||
}
|
||||
}
|
56
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/README.md
vendored
Normal file
56
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/README.md
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Doctrine Bundle
|
||||
|
||||
Doctrine DBAL & ORM Bundle for the Symfony Framework.
|
||||
|
||||
Because Symfony 2 does not want to force or suggest a specific persistence solutions on the users
|
||||
this bundle was removed from the core of the Symfony 2 framework. Doctrine2 will still be a major player
|
||||
in the Symfony world and the bundle is maintained by developers in the Doctrine and Symfony communities.
|
||||
|
||||
IMPORTANT: This bundle is developed for Symfony 2.1 and up. For Symfony 2.0 applications the DoctrineBundle
|
||||
is still shipped with the core Symfony repository.
|
||||
|
||||
Build Status: [](http://travis-ci.org/doctrine/DoctrineBundle)
|
||||
|
||||
## What is Doctrine?
|
||||
|
||||
The Doctrine Project is the home of a selected set of PHP libraries primarily focused on providing persistence
|
||||
services and related functionality. Its prize projects are a Object Relational Mapper and the Database Abstraction
|
||||
Layer it is built on top of. You can read more about the projects below or view a list of all projects.
|
||||
|
||||
Object relational mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL).
|
||||
One of its key features is the option to write database queries in a proprietary object oriented SQL dialect
|
||||
called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful
|
||||
alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
|
||||
|
||||
DBAL is a powerful database abstraction layer with many features for database schema introspection,
|
||||
schema management and PDO abstraction.
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Old deps and bin/vendors way
|
||||
|
||||
Add the following snippets to "deps" files:
|
||||
|
||||
[doctrine-dbal]
|
||||
git=http://github.com/doctrine/dbal.git
|
||||
|
||||
[doctrine-orm]
|
||||
git=http://github.com/doctrine/doctrine2.git
|
||||
|
||||
[DoctrineBundle]
|
||||
git=http://github.com/doctrine/DoctrineBundle.git
|
||||
target=/bundles/Doctrine/Bundle/DoctrineBundle
|
||||
|
||||
### 2. Composer
|
||||
|
||||
Add the following dependencies to your projects composer.json file:
|
||||
|
||||
"require": {
|
||||
# ..
|
||||
"doctrine/doctrine-bundle": ">=2.1"
|
||||
# ..
|
||||
}
|
||||
|
||||
## Documentation
|
||||
|
||||
See the Resources/docs folder more a full documentation.
|
155
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php
vendored
Normal file
155
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Registry.php
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Bridge\Doctrine\RegistryInterface;
|
||||
use Symfony\Bridge\Doctrine\ManagerRegistry;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* References all Doctrine connections and entity managers in a given Container.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Registry extends ManagerRegistry implements RegistryInterface
|
||||
{
|
||||
public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager)
|
||||
{
|
||||
$this->setContainer($container);
|
||||
|
||||
parent::__construct('ORM', $connections, $entityManagers, $defaultConnection, $defaultEntityManager, 'Doctrine\ORM\Proxy\Proxy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default entity manager name.
|
||||
*
|
||||
* @return string The default entity manager name
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getDefaultEntityManagerName()
|
||||
{
|
||||
return $this->getDefaultManagerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a named entity manager.
|
||||
*
|
||||
* @param string $name The entity manager name (null for the default one)
|
||||
*
|
||||
* @return EntityManager
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getEntityManager($name = null)
|
||||
{
|
||||
return $this->getManager($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of all registered entity managers
|
||||
*
|
||||
* @return EntityManager[] an array of all EntityManager instances
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getEntityManagers()
|
||||
{
|
||||
return $this->getManagers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a named entity manager.
|
||||
*
|
||||
* This method is useful when an entity manager has been closed
|
||||
* because of a rollbacked transaction AND when you think that
|
||||
* it makes sense to get a new one to replace the closed one.
|
||||
*
|
||||
* Be warned that you will get a brand new entity manager as
|
||||
* the existing one is not useable anymore. This means that any
|
||||
* other object with a dependency on this entity manager will
|
||||
* hold an obsolete reference. You can inject the registry instead
|
||||
* to avoid this problem.
|
||||
*
|
||||
* @param string $name The entity manager name (null for the default one)
|
||||
*
|
||||
* @return EntityManager
|
||||
*/
|
||||
public function resetEntityManager($name = null)
|
||||
{
|
||||
$this->resetManager($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a registered namespace alias to the full namespace.
|
||||
*
|
||||
* This method looks for the alias in all registered entity managers.
|
||||
*
|
||||
* @param string $alias The alias
|
||||
*
|
||||
* @return string The full namespace
|
||||
*/
|
||||
public function getEntityNamespace($alias)
|
||||
{
|
||||
return $this->getAliasNamespace($alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a registered namespace alias to the full namespace.
|
||||
*
|
||||
* This method looks for the alias in all registered entity managers.
|
||||
*
|
||||
* @param string $alias The alias
|
||||
*
|
||||
* @return string The full namespace
|
||||
*
|
||||
* @see Configuration::getEntityNamespace
|
||||
*/
|
||||
public function getAliasNamespace($alias)
|
||||
{
|
||||
foreach (array_keys($this->getManagers()) as $name) {
|
||||
try {
|
||||
return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias);
|
||||
} catch (ORMException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
throw ORMException::unknownEntityNamespace($alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all connection names.
|
||||
*
|
||||
* @return array An array of connection names
|
||||
*/
|
||||
public function getEntityManagerNames()
|
||||
{
|
||||
return $this->getManagerNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity manager associated with a given class.
|
||||
*
|
||||
* @param string $class A Doctrine Entity class name
|
||||
*
|
||||
* @return EntityManager|null
|
||||
*/
|
||||
public function getEntityManagerForClass($class)
|
||||
{
|
||||
return $this->getManagerForClass($class);
|
||||
}
|
||||
}
|
62
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/dbal.xml
vendored
Normal file
62
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/dbal.xml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="doctrine.dbal.logger.chain.class">Doctrine\DBAL\Logging\LoggerChain</parameter>
|
||||
<parameter key="doctrine.dbal.logger.profiling.class">Doctrine\DBAL\Logging\DebugStack</parameter>
|
||||
<parameter key="doctrine.dbal.logger.class">Symfony\Bridge\Doctrine\Logger\DbalLogger</parameter>
|
||||
<parameter key="doctrine.dbal.configuration.class">Doctrine\DBAL\Configuration</parameter>
|
||||
<parameter key="doctrine.data_collector.class">Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector</parameter>
|
||||
<parameter key="doctrine.dbal.connection.event_manager.class">Symfony\Bridge\Doctrine\ContainerAwareEventManager</parameter>
|
||||
<parameter key="doctrine.dbal.connection_factory.class">Doctrine\Bundle\DoctrineBundle\ConnectionFactory</parameter>
|
||||
<parameter key="doctrine.dbal.events.mysql_session_init.class">Doctrine\DBAL\Event\Listeners\MysqlSessionInit</parameter>
|
||||
<parameter key="doctrine.dbal.events.oracle_session_init.class">Doctrine\DBAL\Event\Listeners\OracleSessionInit</parameter>
|
||||
<parameter key="doctrine.class">Doctrine\Bundle\DoctrineBundle\Registry</parameter>
|
||||
<parameter key="doctrine.entity_managers" type="collection"></parameter>
|
||||
<parameter key="doctrine.default_entity_manager"></parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="doctrine.dbal.logger.chain" class="%doctrine.dbal.logger.chain.class%" public="false" abstract="true">
|
||||
<call method="addLogger">
|
||||
<argument type="service" id="doctrine.dbal.logger" />
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="doctrine.dbal.logger.profiling" class="%doctrine.dbal.logger.profiling.class%" public="false" abstract="true" />
|
||||
|
||||
<service id="doctrine.dbal.logger" class="%doctrine.dbal.logger.class%" public="false">
|
||||
<tag name="monolog.logger" channel="doctrine" />
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
<argument type="service" id="debug.stopwatch" on-invalid="null" />
|
||||
</service>
|
||||
|
||||
<service id="data_collector.doctrine" class="%doctrine.data_collector.class%" public="false">
|
||||
<tag name="data_collector" template="DoctrineBundle:Collector:db" id="db" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<service id="doctrine.dbal.connection_factory" class="%doctrine.dbal.connection_factory.class%">
|
||||
<argument>%doctrine.dbal.connection_factory.types%</argument>
|
||||
</service>
|
||||
|
||||
<service id="doctrine.dbal.connection" class="stdClass" factory-service="doctrine.dbal.connection_factory" factory-method="createConnection" abstract="true" />
|
||||
|
||||
<service id="doctrine.dbal.connection.event_manager" class="%doctrine.dbal.connection.event_manager.class%" public="false" abstract="true">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<service id="doctrine.dbal.connection.configuration" class="%doctrine.dbal.configuration.class%" public="false" abstract="true" />
|
||||
|
||||
<service id="doctrine" class="%doctrine.class%">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument>%doctrine.connections%</argument>
|
||||
<argument>%doctrine.entity_managers%</argument>
|
||||
<argument>%doctrine.default_connection%</argument>
|
||||
<argument>%doctrine.default_entity_manager%</argument>
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
97
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml
vendored
Normal file
97
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/config/orm.xml
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="doctrine.orm.configuration.class">Doctrine\ORM\Configuration</parameter>
|
||||
<parameter key="doctrine.orm.entity_manager.class">Doctrine\ORM\EntityManager</parameter>
|
||||
<parameter key="doctrine.orm.manager_configurator.class">Doctrine\Bundle\DoctrineBundle\ManagerConfigurator</parameter>
|
||||
|
||||
<!-- cache -->
|
||||
<parameter key="doctrine.orm.cache.array.class">Doctrine\Common\Cache\ArrayCache</parameter>
|
||||
<parameter key="doctrine.orm.cache.apc.class">Doctrine\Common\Cache\ApcCache</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcache.class">Doctrine\Common\Cache\MemcacheCache</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcache_host">localhost</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcache_port">11211</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcache_instance.class">Memcache</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcached.class">Doctrine\Common\Cache\MemcachedCache</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcached_host">localhost</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcached_port">11211</parameter>
|
||||
<parameter key="doctrine.orm.cache.memcached_instance.class">Memcached</parameter>
|
||||
<parameter key="doctrine.orm.cache.xcache.class">Doctrine\Common\Cache\XcacheCache</parameter>
|
||||
|
||||
<!-- metadata -->
|
||||
<parameter key="doctrine.orm.metadata.driver_chain.class">Doctrine\ORM\Mapping\Driver\DriverChain</parameter>
|
||||
<parameter key="doctrine.orm.metadata.annotation.class">Doctrine\ORM\Mapping\Driver\AnnotationDriver</parameter>
|
||||
<parameter key="doctrine.orm.metadata.xml.class">Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver</parameter>
|
||||
<parameter key="doctrine.orm.metadata.yml.class">Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver</parameter>
|
||||
<parameter key="doctrine.orm.metadata.php.class">Doctrine\ORM\Mapping\Driver\PHPDriver</parameter>
|
||||
<parameter key="doctrine.orm.metadata.staticphp.class">Doctrine\ORM\Mapping\Driver\StaticPHPDriver</parameter>
|
||||
|
||||
<!-- cache warmer -->
|
||||
<parameter key="doctrine.orm.proxy_cache_warmer.class">Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer</parameter>
|
||||
|
||||
<!-- form field factory guesser -->
|
||||
<parameter key="form.type_guesser.doctrine.class">Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser</parameter>
|
||||
|
||||
<!-- validator -->
|
||||
<parameter key="doctrine.orm.validator.unique.class">Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator</parameter>
|
||||
<parameter key="doctrine.orm.validator_initializer.class">Symfony\Bridge\Doctrine\Validator\DoctrineInitializer</parameter>
|
||||
|
||||
<!-- security -->
|
||||
<parameter key="doctrine.orm.security.user.provider.class">Symfony\Bridge\Doctrine\Security\User\EntityUserProvider</parameter>
|
||||
|
||||
<!-- listeners -->
|
||||
<parameter key="doctrine.orm.listeners.resolve_target_entity.class">Doctrine\ORM\Tools\ResolveTargetEntityListener</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<!--- Annotation Metadata Reader Service -->
|
||||
<service id="doctrine.orm.metadata.annotation_reader" alias="annotation_reader" public="false" />
|
||||
|
||||
<service id="doctrine.orm.proxy_cache_warmer" class="%doctrine.orm.proxy_cache_warmer.class%" public="false">
|
||||
<tag name="kernel.cache_warmer" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<service id="form.type_guesser.doctrine" class="%form.type_guesser.doctrine.class%">
|
||||
<tag name="form.type_guesser" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<service id="form.type.entity" class="Symfony\Bridge\Doctrine\Form\Type\EntityType">
|
||||
<tag name="form.type" alias="entity" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<service id="doctrine.orm.configuration" class="%doctrine.orm.configuration.class%" abstract="true" public="false" />
|
||||
|
||||
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" factory-class="%doctrine.orm.entity_manager.class%" factory-method="create" abstract="true" />
|
||||
|
||||
<!-- The configurator cannot be a private service -->
|
||||
<service id="doctrine.orm.manager_configurator.abstract" class="%doctrine.orm.manager_configurator.class%" abstract="true">
|
||||
<argument type="collection" />
|
||||
</service>
|
||||
|
||||
<!-- validator -->
|
||||
<service id="doctrine.orm.validator.unique" class="%doctrine.orm.validator.unique.class%">
|
||||
<tag name="validator.constraint_validator" alias="doctrine.orm.validator.unique" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<service id="doctrine.orm.validator_initializer" class="%doctrine.orm.validator_initializer.class%">
|
||||
<tag name="validator.initializer" />
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<!-- security -->
|
||||
<service id="doctrine.orm.security.user.provider" class="%doctrine.orm.security.user.provider.class%" abstract="true" public="false">
|
||||
<argument type="service" id="doctrine" />
|
||||
</service>
|
||||
|
||||
<!-- listeners -->
|
||||
<service id="doctrine.orm.listeners.resolve_target_entity" class="%doctrine.orm.listeners.resolve_target_entity.class%" public="false" />
|
||||
</services>
|
||||
</container>
|
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<xsd:schema xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://symfony.com/schema/dic/doctrine"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:element name="config">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name="dbal" type="dbal" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="orm" type="orm" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:attributeGroup name="connection-config">
|
||||
<xsd:attribute name="driver" type="xsd:string" />
|
||||
<xsd:attribute name="driver-class" type="xsd:string" />
|
||||
<xsd:attribute name="wrapper-class" type="xsd:string" />
|
||||
<xsd:attribute name="platform-service" type="xsd:string" />
|
||||
<xsd:attribute name="logging" type="xsd:string" default="false" />
|
||||
<xsd:attribute name="profiling" type="xsd:string" default="false" />
|
||||
<xsd:attributeGroup ref="driver-config" />
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:attributeGroup name="driver-config">
|
||||
<xsd:attribute name="dbname" type="xsd:string" />
|
||||
<xsd:attribute name="host" type="xsd:string" />
|
||||
<xsd:attribute name="port" type="xsd:integer" />
|
||||
<xsd:attribute name="user" type="xsd:string" />
|
||||
<xsd:attribute name="password" type="xsd:string" />
|
||||
<xsd:attribute name="path" type="xsd:string" />
|
||||
<xsd:attribute name="unix-socket" type="xsd:string" />
|
||||
<xsd:attribute name="memory" type="xsd:boolean" />
|
||||
<xsd:attribute name="charset" type="xsd:string" />
|
||||
<xsd:attribute name="persistent" type="xsd:boolean" />
|
||||
<xsd:attribute name="protocol" type="xsd:string" />
|
||||
<xsd:attribute name="service" type="xsd:boolean" />
|
||||
<xsd:attribute name="session-mode" type="xsd:string" />
|
||||
<xsd:attribute name="pooled" type="xsd:boolean" />
|
||||
<xsd:attribute name="multiple-active-result-sets" type="xsd:boolean" />
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:complexType name="dbal">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="connection" type="connection" />
|
||||
<xsd:element name="type" type="type" />
|
||||
<xsd:element name="option" type="option" />
|
||||
<xsd:element name="mapping-type" type="mapping-type" />
|
||||
<xsd:element name="slave" type="slave" />
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="default-connection" type="xsd:string" />
|
||||
<xsd:attributeGroup ref="connection-config" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="option">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="mapping-type">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="type">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="connection">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="option" type="option" />
|
||||
<xsd:element name="mapping-type" type="mapping-type" />
|
||||
<xsd:element name="slave" type="slave" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attributeGroup ref="connection-config" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="slave">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attributeGroup ref="driver-config" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="mapping">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="dir" type="xsd:string" />
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="prefix" type="xsd:string" />
|
||||
<xsd:attribute name="is-bundle" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="orm">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="entity-manager" type="entity_manager" />
|
||||
<xsd:element name="mapping" type="mapping" />
|
||||
<xsd:element name="metadata-cache-driver" type="metadata_cache_driver" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="dql" type="dql" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="filter" type="filter" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="resolve-target-entity" type="resolve_target_entity" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="auto-mapping" type="xsd:string" />
|
||||
<xsd:attribute name="default-entity-manager" type="xsd:string" />
|
||||
<xsd:attribute name="default-connection" type="xsd:string" />
|
||||
|
||||
<xsd:attribute name="proxy-dir" type="xsd:string" />
|
||||
<xsd:attribute name="proxy-namespace" type="xsd:string" />
|
||||
<xsd:attribute name="auto-generate-proxy-classes" type="xsd:string" default="false" />
|
||||
<xsd:attribute name="default-repository-class" type="xsd:string" />
|
||||
<xsd:attribute name="result-cache-driver" type="xsd:string" />
|
||||
<xsd:attribute name="metadata-cache-driver" type="xsd:string" />
|
||||
<xsd:attribute name="query-cache-driver" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="resolve_target_entity">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="interface" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="metadata_cache_driver">
|
||||
<xsd:all>
|
||||
<xsd:element name="class" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="host" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="port" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="instance-class" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:all>
|
||||
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="entity_manager">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="mapping" type="mapping" />
|
||||
<xsd:element name="metadata-cache-driver" type="metadata_cache_driver" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="dql" type="dql" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="hydrator" type="type" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="filter" type="filter" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="auto-mapping" type="xsd:string" />
|
||||
<xsd:attribute name="connection" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="default-repository-class" type="xsd:string" />
|
||||
<xsd:attribute name="result-cache-driver" type="xsd:string" />
|
||||
<xsd:attribute name="metadata-cache-driver" type="xsd:string" />
|
||||
<xsd:attribute name="query-cache-driver" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="filter">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="dql">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="string-function" type="dql_function" />
|
||||
<xsd:element name="numeric-function" type="dql_function" />
|
||||
<xsd:element name="datetime-function" type="dql_function" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="dql_function">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
305
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst
vendored
Normal file
305
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/configuration.rst
vendored
Normal file
@@ -0,0 +1,305 @@
|
||||
.. index::
|
||||
single: Doctrine; ORM Configuration Reference
|
||||
single: Configuration Reference; Doctrine ORM
|
||||
|
||||
Configuration Reference
|
||||
=======================
|
||||
|
||||
.. configuration-block::
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: database
|
||||
host: localhost
|
||||
port: 1234
|
||||
user: user
|
||||
password: secret
|
||||
driver: pdo_mysql
|
||||
driver_class: MyNamespace\MyDriverImpl
|
||||
options:
|
||||
foo: bar
|
||||
path: %kernel.data_dir%/data.sqlite
|
||||
memory: true
|
||||
unix_socket: /tmp/mysql.sock
|
||||
wrapper_class: MyDoctrineDbalConnectionWrapper
|
||||
charset: UTF8
|
||||
logging: %kernel.debug%
|
||||
platform_service: MyOwnDatabasePlatformService
|
||||
mapping_types:
|
||||
enum: string
|
||||
conn1:
|
||||
# ...
|
||||
types:
|
||||
custom: Acme\HelloBundle\MyCustomType
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
proxy_namespace: Proxies
|
||||
proxy_dir: %kernel.cache_dir%/doctrine/orm/Proxies
|
||||
default_entity_manager: default # The first defined is used if not set
|
||||
entity_managers:
|
||||
default:
|
||||
# The name of a DBAL connection (the one marked as default is used if not set)
|
||||
connection: conn1
|
||||
mappings: # Required
|
||||
AcmeHelloBundle: ~
|
||||
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
|
||||
# All cache drivers have to be array, apc, xcache or memcache
|
||||
metadata_cache_driver: array
|
||||
query_cache_driver: array
|
||||
result_cache_driver:
|
||||
type: memcache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
dql:
|
||||
string_functions:
|
||||
test_string: Acme\HelloBundle\DQL\StringFunction
|
||||
numeric_functions:
|
||||
test_numeric: Acme\HelloBundle\DQL\NumericFunction
|
||||
datetime_functions:
|
||||
test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
|
||||
em2:
|
||||
# ...
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<doctrine:config>
|
||||
<doctrine:dbal default-connection="default">
|
||||
<doctrine:connection
|
||||
name="default"
|
||||
dbname="database"
|
||||
host="localhost"
|
||||
port="1234"
|
||||
user="user"
|
||||
password="secret"
|
||||
driver="pdo_mysql"
|
||||
driver-class="MyNamespace\MyDriverImpl"
|
||||
path="%kernel.data_dir%/data.sqlite"
|
||||
memory="true"
|
||||
unix-socket="/tmp/mysql.sock"
|
||||
wrapper-class="MyDoctrineDbalConnectionWrapper"
|
||||
charset="UTF8"
|
||||
logging="%kernel.debug%"
|
||||
platform-service="MyOwnDatabasePlatformService"
|
||||
>
|
||||
<doctrine:option key="foo">bar</doctrine:option>
|
||||
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
|
||||
</doctrine:connection>
|
||||
<doctrine:connection name="conn1" />
|
||||
<doctrine:type name="custom">Acme\HelloBundle\MyCustomType</doctrine:type>
|
||||
</doctrine:dbal>
|
||||
|
||||
<doctrine:orm default-entity-manager="default" auto-generate-proxy-classes="false" proxy-namespace="Proxies" proxy-dir="%kernel.cache_dir%/doctrine/orm/Proxies">
|
||||
<doctrine:entity-manager name="default" query-cache-driver="array" result-cache-driver="array" connection="conn1" class-metadata-factory-name="Doctrine\ORM\Mapping\ClassMetadataFactory">
|
||||
<doctrine:metadata-cache-driver type="memcache" host="localhost" port="11211" instance-class="Memcache" class="Doctrine\Common\Cache\MemcacheCache" />
|
||||
<doctrine:mapping name="AcmeHelloBundle" />
|
||||
<doctrine:dql>
|
||||
<doctrine:string-function name="test_string>Acme\HelloBundle\DQL\StringFunction</doctrine:string-function>
|
||||
<doctrine:numeric-function name="test_numeric>Acme\HelloBundle\DQL\NumericFunction</doctrine:numeric-function>
|
||||
<doctrine:datetime-function name="test_datetime>Acme\HelloBundle\DQL\DatetimeFunction</doctrine:datetime-function>
|
||||
</doctrine:dql>
|
||||
</doctrine:entity-manager>
|
||||
<doctrine:entity-manager name="em2" connection="conn2" metadata-cache-driver="apc">
|
||||
<doctrine:mapping
|
||||
name="DoctrineExtensions"
|
||||
type="xml"
|
||||
dir="%kernel.root_dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Entity"
|
||||
prefix="DoctrineExtensions\Entity"
|
||||
alias="DExt"
|
||||
/>
|
||||
</doctrine:entity-manager>
|
||||
</doctrine:orm>
|
||||
</doctrine:config>
|
||||
</container>
|
||||
|
||||
Configuration Overview
|
||||
----------------------
|
||||
|
||||
This following configuration example shows all the configuration defaults that
|
||||
the ORM resolves to:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
doctrine:
|
||||
orm:
|
||||
auto_mapping: true
|
||||
# the standard distribution overrides this to be true in debug, false otherwise
|
||||
auto_generate_proxy_classes: false
|
||||
proxy_namespace: Proxies
|
||||
proxy_dir: %kernel.cache_dir%/doctrine/orm/Proxies
|
||||
default_entity_manager: default
|
||||
metadata_cache_driver: array
|
||||
query_cache_driver: array
|
||||
result_cache_driver: array
|
||||
|
||||
There are lots of other configuration options that you can use to overwrite
|
||||
certain classes, but those are for very advanced use-cases only.
|
||||
|
||||
Caching Drivers
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
For the caching drivers you can specify the values "array", "apc", "memcache"
|
||||
or "xcache".
|
||||
|
||||
The following example shows an overview of the caching configurations:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
doctrine:
|
||||
orm:
|
||||
auto_mapping: true
|
||||
metadata_cache_driver: apc
|
||||
query_cache_driver: xcache
|
||||
result_cache_driver:
|
||||
type: memcache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
||||
|
||||
Mapping Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Explicit definition of all the mapped entities is the only necessary
|
||||
configuration for the ORM and there are several configuration options that you
|
||||
can control. The following configuration options exist for a mapping:
|
||||
|
||||
* ``type`` One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``.
|
||||
This specifies which type of metadata type your mapping uses.
|
||||
|
||||
* ``dir`` Path to the mapping or entity files (depending on the driver). If
|
||||
this path is relative it is assumed to be relative to the bundle root. This
|
||||
only works if the name of your mapping is a bundle name. If you want to use
|
||||
this option to specify absolute paths you should prefix the path with the
|
||||
kernel parameters that exist in the DIC (for example %kernel.root_dir%).
|
||||
|
||||
* ``prefix`` A common namespace prefix that all entities of this mapping
|
||||
share. This prefix should never conflict with prefixes of other defined
|
||||
mappings otherwise some of your entities cannot be found by Doctrine. This
|
||||
option defaults to the bundle namespace + ``Entity``, for example for an
|
||||
application bundle called ``AcmeHelloBundle`` prefix would be
|
||||
``Acme\HelloBundle\Entity``.
|
||||
|
||||
* ``alias`` Doctrine offers a way to alias entity namespaces to simpler,
|
||||
shorter names to be used in DQL queries or for Repository access. When using
|
||||
a bundle the alias defaults to the bundle name.
|
||||
|
||||
* ``is_bundle`` This option is a derived value from ``dir`` and by default is
|
||||
set to true if dir is relative proved by a ``file_exists()`` check that
|
||||
returns false. It is false if the existence check returns true. In this case
|
||||
an absolute path was specified and the metadata files are most likely in a
|
||||
directory outside of a bundle.
|
||||
|
||||
.. index::
|
||||
single: Configuration; Doctrine DBAL
|
||||
single: Doctrine; DBAL configuration
|
||||
|
||||
.. _`reference-dbal-configuration`:
|
||||
|
||||
Doctrine DBAL Configuration
|
||||
---------------------------
|
||||
|
||||
.. note::
|
||||
|
||||
DoctrineBundle supports all parameters that default Doctrine drivers
|
||||
accept, converted to the XML or YAML naming standards that Symfony
|
||||
enforces. See the Doctrine `DBAL documentation`_ for more information.
|
||||
|
||||
Besides default Doctrine options, there are some Symfony-related ones that you
|
||||
can configure. The following block shows all possible configuration keys:
|
||||
|
||||
.. configuration-block::
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
dbname: database
|
||||
host: localhost
|
||||
port: 1234
|
||||
user: user
|
||||
password: secret
|
||||
driver: pdo_mysql
|
||||
driver_class: MyNamespace\MyDriverImpl
|
||||
options:
|
||||
foo: bar
|
||||
path: %kernel.data_dir%/data.sqlite
|
||||
memory: true
|
||||
unix_socket: /tmp/mysql.sock
|
||||
wrapper_class: MyDoctrineDbalConnectionWrapper
|
||||
charset: UTF8
|
||||
logging: %kernel.debug%
|
||||
platform_service: MyOwnDatabasePlatformService
|
||||
mapping_types:
|
||||
enum: string
|
||||
types:
|
||||
custom: Acme\HelloBundle\MyCustomType
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<!-- xmlns:doctrine="http://symfony.com/schema/dic/doctrine" -->
|
||||
<!-- xsi:schemaLocation="http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> -->
|
||||
|
||||
<doctrine:config>
|
||||
<doctrine:dbal
|
||||
name="default"
|
||||
dbname="database"
|
||||
host="localhost"
|
||||
port="1234"
|
||||
user="user"
|
||||
password="secret"
|
||||
driver="pdo_mysql"
|
||||
driver-class="MyNamespace\MyDriverImpl"
|
||||
path="%kernel.data_dir%/data.sqlite"
|
||||
memory="true"
|
||||
unix-socket="/tmp/mysql.sock"
|
||||
wrapper-class="MyDoctrineDbalConnectionWrapper"
|
||||
charset="UTF8"
|
||||
logging="%kernel.debug%"
|
||||
platform-service="MyOwnDatabasePlatformService"
|
||||
>
|
||||
<doctrine:option key="foo">bar</doctrine:option>
|
||||
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
|
||||
<doctrine:type name="custom">Acme\HelloBundle\MyCustomType</doctrine:type>
|
||||
</doctrine:dbal>
|
||||
</doctrine:config>
|
||||
|
||||
If you want to configure multiple connections in YAML, put them under the
|
||||
``connections`` key and give them a unique name:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: Symfony2
|
||||
user: root
|
||||
password: null
|
||||
host: localhost
|
||||
customer:
|
||||
dbname: customer
|
||||
user: root
|
||||
password: null
|
||||
host: localhost
|
||||
|
||||
The ``database_connection`` service always refers to the *default* connection,
|
||||
which is the first one defined or the one configured via the
|
||||
``default_connection`` parameter.
|
||||
|
||||
Each connection is also accessible via the ``doctrine.dbal.[name]_connection``
|
||||
service where ``[name]`` if the name of the connection.
|
||||
|
||||
.. _DBAL documentation: http://www.doctrine-project.org/docs/dbal/2.0/en
|
43
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/installation.rst
vendored
Normal file
43
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/doc/installation.rst
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
Doctrine Bundle
|
||||
===============
|
||||
|
||||
Doctrine DBAL & ORM Bundle for the Symfony Framework.
|
||||
|
||||
Because Symfony 2 does not want to force or suggest a specific persistence solutions on the users
|
||||
this bundle was removed from the core of the Symfony 2 framework. Doctrine2 will still be a major player
|
||||
in the Symfony world and the bundle is maintained by developers in the Doctrine and Symfony communities.
|
||||
|
||||
IMPORTANT: This bundle is developed for Symfony 2.1 and up. For Symfony 2.0 applications the DoctrineBundle
|
||||
is still shipped with the core Symfony repository.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
1. Old deps and bin/vendors way
|
||||
|
||||
Add the following snippets to "deps" files:
|
||||
|
||||
.. code-block::
|
||||
|
||||
[doctrine-mongodb]
|
||||
git=http://github.com/doctrine/dbal.git
|
||||
|
||||
[doctrine-mongodb-odm]
|
||||
git=http://github.com/doctrine/doctrine2.git
|
||||
|
||||
[DoctrineBundle]
|
||||
git=http://github.com/doctrine/DoctrineBundle.git
|
||||
target=/bundles/Doctrine/Bundle/DoctrineBundle
|
||||
|
||||
2. Composer
|
||||
|
||||
Add the following dependencies to your projects composer.json file:
|
||||
|
||||
.. code-block::
|
||||
|
||||
"require": {
|
||||
# ..
|
||||
"doctrine/doctrine-bundle": ">=2.1"
|
||||
# ..
|
||||
}
|
||||
|
@@ -0,0 +1,122 @@
|
||||
{% extends app.request.isXmlHttpRequest ? 'WebProfilerBundle:Profiler:ajax_layout.html.twig' : 'WebProfilerBundle:Profiler:layout.html.twig' %}
|
||||
|
||||
{% block toolbar %}
|
||||
{% set icon %}
|
||||
<img width="20" height="28" alt="Database" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAcCAYAAABh2p9gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQRJREFUeNpi/P//PwM1ARMDlcGogZQDlpMnT7pxc3NbA9nhQKxOpL5rQLwJiPeBsI6Ozl+YBOOOHTv+AOllQNwtLS39F2owKYZ/gRq8G4i3ggxEToggWzvc3d2Pk+1lNL4fFAs6ODi8JzdS7mMRVyDVoAMHDsANdAPiOCC+jCQvQKqBQB/BDbwBxK5AHA3E/kB8nKJkA8TMQBwLxaBIKQbi70AvTADSBiSadwFXpCikpKQU8PDwkGTaly9fHFigkaKIJid4584dkiMFFI6jkTJII0WVmpHCAixZQEXWYhDeuXMnyLsVlEQKI45qFBQZ8eRECi4DBaAlDqle/8A48ip6gAADANdQY88Uc0oGAAAAAElFTkSuQmCC"/>
|
||||
<span class="sf-toolbar-status">{{ collector.querycount }}</span>
|
||||
<span class="sf-toolbar-info-piece-additional-detail">in {{ '%0.2f'|format(collector.time * 1000) }} ms</span>
|
||||
{% endset %}
|
||||
{% set text %}
|
||||
<div class="sf-toolbar-info-piece">
|
||||
<b>DB Queries</b>
|
||||
<span>{{ collector.querycount }}</span>
|
||||
</div>
|
||||
<div class="sf-toolbar-info-piece">
|
||||
<b>Query time</b>
|
||||
<span>{{ '%0.2f'|format(collector.time * 1000) }} ms</span>
|
||||
</div>
|
||||
{% endset %}
|
||||
{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<span class="label">
|
||||
<span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/db.png') }}" alt="" /></span>
|
||||
<strong>Doctrine</strong>
|
||||
<span class="count">
|
||||
<span>{{ collector.querycount }}</span>
|
||||
<span>{{ '%0.0f'|format(collector.time * 1000) }} ms</span>
|
||||
</span>
|
||||
</span>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
{% if 'explain' == page %}
|
||||
{% render 'DoctrineBundle:Profiler:explain' with {
|
||||
'token': token,
|
||||
'panel': 'db',
|
||||
'connectionName': app.request.query.get('connection'),
|
||||
'query': app.request.query.get('query')
|
||||
} %}
|
||||
{% else %}
|
||||
{{ block('queries') }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block queries %}
|
||||
<h2>Queries</h2>
|
||||
|
||||
{% for connection, queries in collector.queries %}
|
||||
<h3>Connection <em>{{ connection }}</em></h3>
|
||||
{% if queries is empty %}
|
||||
<p>
|
||||
<em>No queries.</em>
|
||||
</p>
|
||||
{% else %}
|
||||
<ul class="alt">
|
||||
{% for i, query in queries %}
|
||||
<li class="{{ cycle(['odd', 'even'], i) }}">
|
||||
<div>
|
||||
{% if query.explainable %}
|
||||
<a href="{{ path('_profiler', {'panel': 'db', 'token': token, 'page': 'explain', 'connection': connection, 'query': i}) }}" onclick="return explain(this);" style="text-decoration: none;" title="Explains" data-target-id="explain-{{ i }}-{{ loop.parent.loop.index }}" >
|
||||
<img alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="display: inline;" />
|
||||
<img alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="display: none;" />
|
||||
</a>
|
||||
{% endif %}
|
||||
<code>{{ query.sql }}</code>
|
||||
</div>
|
||||
<small>
|
||||
<strong>Parameters</strong>: {{ query.params|yaml_encode }}<br />
|
||||
<strong>Time</strong>: {{ '%0.2f'|format(query.executionMS * 1000) }} ms
|
||||
</small>
|
||||
{% if query.explainable %}
|
||||
<div id="explain-{{ i }}-{{ loop.parent.loop.index }}" class="loading"></div>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<h2>Database Connections</h2>
|
||||
|
||||
{% if collector.connections %}
|
||||
{% include 'WebProfilerBundle:Profiler:table.html.twig' with {data: collector.connections} only %}
|
||||
{% else %}
|
||||
<p>
|
||||
<em>No connections.</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<h2>Entity Managers</h2>
|
||||
|
||||
{% if collector.managers %}
|
||||
{% include 'WebProfilerBundle:Profiler:table.html.twig' with {data: collector.managers} only %}
|
||||
{% else %}
|
||||
<p>
|
||||
<em>No entity managers.</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function explain(link) {
|
||||
"use strict";
|
||||
|
||||
var imgs = link.children,
|
||||
target = link.getAttribute('data-target-id');
|
||||
|
||||
Sfjs.toggle(target, imgs[0], imgs[1])
|
||||
.load(
|
||||
target,
|
||||
link.href,
|
||||
null,
|
||||
function(xhr, el) {
|
||||
el.innerHTML = 'An error occurred while loading the details';
|
||||
Sfjs.removeClass(el, 'loading');
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
{% endblock %}
|
@@ -0,0 +1,20 @@
|
||||
<small><strong>Explanation</strong>:</small>
|
||||
|
||||
<table style="margin: 5px 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
{% for label in data[0]|keys %}
|
||||
<th>{{ label }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in data %}
|
||||
<tr>
|
||||
{% for item in row %}
|
||||
<td>{{ item }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
47
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/BundleTest.php
vendored
Normal file
47
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/BundleTest.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests;
|
||||
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
||||
|
||||
class BundleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testBuildCompilerPasses()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$bundle = new DoctrineBundle();
|
||||
$bundle->build($container);
|
||||
|
||||
$config = $container->getCompilerPassConfig();
|
||||
$passes = $config->getBeforeOptimizationPasses();
|
||||
|
||||
$foundEventListener = false;
|
||||
$foundValidation = false;
|
||||
|
||||
foreach ($passes as $pass) {
|
||||
if ($pass instanceof RegisterEventListenersAndSubscribersPass) {
|
||||
$foundEventListener = true;
|
||||
} elseif ($pass instanceof DoctrineValidationPass) {
|
||||
$foundValidation = true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertTrue($foundEventListener, 'RegisterEventListenersAndSubcribersPass was not found');
|
||||
$this->assertTrue($foundValidation, 'DoctrineValidationPass was not found');
|
||||
}
|
||||
}
|
59
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/ContainerTest.php
vendored
Normal file
59
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/ContainerTest.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests;
|
||||
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
|
||||
class ContainerTest extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (!class_exists('Doctrine\\ORM\\Version')) {
|
||||
$this->markTestSkipped('Doctrine ORM is not available.');
|
||||
}
|
||||
}
|
||||
|
||||
public function testContainer()
|
||||
{
|
||||
$container = $this->createYamlBundleTestContainer();
|
||||
|
||||
$this->assertInstanceOf('Symfony\Bridge\Doctrine\Logger\DbalLogger', $container->get('doctrine.dbal.logger'));
|
||||
$this->assertInstanceOf('Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector', $container->get('data_collector.doctrine'));
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Configuration', $container->get('doctrine.dbal.default_connection.configuration'));
|
||||
$this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.dbal.default_connection.event_manager'));
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Connection', $container->get('doctrine.dbal.default_connection'));
|
||||
$this->assertInstanceOf('Doctrine\Common\Annotations\Reader', $container->get('doctrine.orm.metadata.annotation_reader'));
|
||||
$this->assertInstanceOf('Doctrine\ORM\Configuration', $container->get('doctrine.orm.default_configuration'));
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\Driver\DriverChain', $container->get('doctrine.orm.default_metadata_driver'));
|
||||
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.orm.default_metadata_cache'));
|
||||
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.orm.default_query_cache'));
|
||||
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container->get('doctrine.orm.default_result_cache'));
|
||||
$this->assertInstanceOf('Doctrine\ORM\EntityManager', $container->get('doctrine.orm.default_entity_manager'));
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Connection', $container->get('database_connection'));
|
||||
$this->assertInstanceOf('Doctrine\ORM\EntityManager', $container->get('doctrine.orm.entity_manager'));
|
||||
$this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.orm.default_entity_manager.event_manager'));
|
||||
$this->assertInstanceOf('Doctrine\Common\EventManager', $container->get('doctrine.dbal.event_manager'));
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Event\Listeners\MysqlSessionInit', $container->get('doctrine.dbal.default_connection.events.mysqlsessioninit'));
|
||||
$this->assertInstanceOf('Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer', $container->get('doctrine.orm.proxy_cache_warmer'));
|
||||
$this->assertInstanceOf('Doctrine\Common\Persistence\ManagerRegistry', $container->get('doctrine'));
|
||||
$this->assertInstanceOf('Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator', $container->get('doctrine.orm.validator.unique'));
|
||||
|
||||
$this->assertSame($container->get('my.platform'), $container->get('doctrine.dbal.default_connection')->getDatabasePlatform());
|
||||
|
||||
$this->assertTrue(Type::hasType('test'));
|
||||
}
|
||||
}
|
@@ -0,0 +1,854 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\Bundle\DoctrineBundle\Tests\TestCase;
|
||||
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
abstract class AbstractDoctrineExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
abstract protected function loadFromFile(ContainerBuilder $container, $file);
|
||||
|
||||
public function testDbalOverrideDefaultConnection()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);
|
||||
|
||||
// doctrine.dbal.default_connection
|
||||
$this->assertEquals('%doctrine.default_connection%', $container->getDefinition('doctrine')->getArgument(3), '->load() overrides existing configuration options');
|
||||
$this->assertEquals('foo', $container->getParameter('doctrine.default_connection'), '->load() overrides existing configuration options');
|
||||
|
||||
}
|
||||
|
||||
public function testDbalLoad()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo')))), array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);
|
||||
|
||||
$config = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0);
|
||||
|
||||
$this->assertEquals('foo', $config['password']);
|
||||
$this->assertEquals('root', $config['user']);
|
||||
}
|
||||
|
||||
public function testDbalLoadFromXmlMultipleConnections()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'dbal_service_multiple_connections');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
// doctrine.dbal.mysql_connection
|
||||
$config = $container->getDefinition('doctrine.dbal.mysql_connection')->getArgument(0);
|
||||
|
||||
$this->assertEquals('mysql_s3cr3t', $config['password']);
|
||||
$this->assertEquals('mysql_user', $config['user']);
|
||||
$this->assertEquals('mysql_db', $config['dbname']);
|
||||
$this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']);
|
||||
|
||||
// doctrine.dbal.sqlite_connection
|
||||
$config = $container->getDefinition('doctrine.dbal.sqlite_connection')->getArgument(0);
|
||||
$this->assertArrayHasKey('memory', $config);
|
||||
|
||||
// doctrine.dbal.oci8_connection
|
||||
$config = $container->getDefinition('doctrine.dbal.oci_connection')->getArgument(0);
|
||||
$this->assertArrayHasKey('charset', $config);
|
||||
}
|
||||
|
||||
public function testDbalLoadFromXmlSingleConnections()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'dbal_service_single_connection');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
// doctrine.dbal.mysql_connection
|
||||
$config = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0);
|
||||
|
||||
$this->assertEquals('mysql_s3cr3t', $config['password']);
|
||||
$this->assertEquals('mysql_user', $config['user']);
|
||||
$this->assertEquals('mysql_db', $config['dbname']);
|
||||
$this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']);
|
||||
}
|
||||
|
||||
public function testDbalLoadSingleMasterSlaveConnection()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'dbal_service_single_master_slave_connection');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
// doctrine.dbal.mysql_connection
|
||||
$param = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0);
|
||||
|
||||
$this->assertEquals('Doctrine\\DBAL\\Connections\\MasterSlaveConnection', $param['wrapperClass']);
|
||||
$this->assertEquals(
|
||||
array('user' => 'mysql_user', 'password' => 'mysql_s3cr3t', 'port' => null, 'dbname' => 'mysql_db', 'host' => 'localhost', 'unix_socket' => '/path/to/mysqld.sock'),
|
||||
$param['master']
|
||||
);
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'user' => 'slave_user', 'password' => 'slave_s3cr3t', 'port' => null, 'dbname' => 'slave_db',
|
||||
'host' => 'localhost', 'unix_socket' => '/path/to/mysqld_slave.sock'
|
||||
),
|
||||
$param['slaves']['slave1']
|
||||
);
|
||||
}
|
||||
|
||||
public function testDependencyInjectionConfigurationDefaults()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
|
||||
|
||||
$this->assertFalse($container->getParameter('doctrine.orm.auto_generate_proxy_classes'));
|
||||
$this->assertEquals('Doctrine\ORM\Configuration', $container->getParameter('doctrine.orm.configuration.class'));
|
||||
$this->assertEquals('Doctrine\ORM\EntityManager', $container->getParameter('doctrine.orm.entity_manager.class'));
|
||||
$this->assertEquals('Proxies', $container->getParameter('doctrine.orm.proxy_namespace'));
|
||||
$this->assertEquals('Doctrine\Common\Cache\ArrayCache', $container->getParameter('doctrine.orm.cache.array.class'));
|
||||
$this->assertEquals('Doctrine\Common\Cache\ApcCache', $container->getParameter('doctrine.orm.cache.apc.class'));
|
||||
$this->assertEquals('Doctrine\Common\Cache\MemcacheCache', $container->getParameter('doctrine.orm.cache.memcache.class'));
|
||||
$this->assertEquals('localhost', $container->getParameter('doctrine.orm.cache.memcache_host'));
|
||||
$this->assertEquals('11211', $container->getParameter('doctrine.orm.cache.memcache_port'));
|
||||
$this->assertEquals('Memcache', $container->getParameter('doctrine.orm.cache.memcache_instance.class'));
|
||||
$this->assertEquals('Doctrine\Common\Cache\XcacheCache', $container->getParameter('doctrine.orm.cache.xcache.class'));
|
||||
$this->assertEquals('Doctrine\ORM\Mapping\Driver\DriverChain', $container->getParameter('doctrine.orm.metadata.driver_chain.class'));
|
||||
$this->assertEquals('Doctrine\ORM\Mapping\Driver\AnnotationDriver', $container->getParameter('doctrine.orm.metadata.annotation.class'));
|
||||
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver', $container->getParameter('doctrine.orm.metadata.xml.class'));
|
||||
$this->assertEquals('Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver', $container->getParameter('doctrine.orm.metadata.yml.class'));
|
||||
|
||||
$config = array(
|
||||
'proxy_namespace' => 'MyProxies',
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array(
|
||||
'mappings' => array('YamlBundle' => array()),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$container = $this->getContainer();
|
||||
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => $config)), $container);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
|
||||
$args = $definition->getArguments();
|
||||
$this->assertEquals('pdo_mysql', $args[0]['driver']);
|
||||
$this->assertEquals('localhost', $args[0]['host']);
|
||||
$this->assertEquals('root', $args[0]['user']);
|
||||
$this->assertEquals('doctrine.dbal.default_connection.configuration', (string) $args[1]);
|
||||
$this->assertEquals('doctrine.dbal.default_connection.event_manager', (string) $args[2]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$this->assertEquals(array('default' => 'doctrine.orm.default_entity_manager'), $container->getParameter('doctrine.entity_managers'), "Set of the existing EntityManagers names is incorrect.");
|
||||
$this->assertEquals('%doctrine.entity_managers%', $container->getDefinition('doctrine')->getArgument(2), "Set of the existing EntityManagers names is incorrect.");
|
||||
|
||||
$arguments = $definition->getArguments();
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]);
|
||||
$this->assertEquals('doctrine.dbal.default_connection', (string) $arguments[0]);
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.default_configuration', (string) $arguments[1]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$calls = array_values($definition->getMethodCalls());
|
||||
$this->assertEquals(array('YamlBundle' => 'Fixtures\Bundles\YamlBundle\Entity'), $calls[0][1][0]);
|
||||
$this->assertEquals('doctrine.orm.default_metadata_cache', (string) $calls[1][1][0]);
|
||||
$this->assertEquals('doctrine.orm.default_query_cache', (string) $calls[2][1][0]);
|
||||
$this->assertEquals('doctrine.orm.default_result_cache', (string) $calls[3][1][0]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_query_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_result_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass());
|
||||
}
|
||||
|
||||
public function testSingleEntityManagerConfiguration()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
new Reference('doctrine.dbal.default_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
));
|
||||
}
|
||||
|
||||
public function testLoadSimpleSingleConnection()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_simple_single_entity_manager');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
array(
|
||||
'dbname' => 'db',
|
||||
'host' => 'localhost',
|
||||
'port' => null,
|
||||
'user' => 'root',
|
||||
'password' => null,
|
||||
'driver' => 'pdo_mysql',
|
||||
'driverOptions' => array(),
|
||||
),
|
||||
new Reference('doctrine.dbal.default_connection.configuration'),
|
||||
new Reference('doctrine.dbal.default_connection.event_manager'),
|
||||
array(),
|
||||
));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
new Reference('doctrine.dbal.default_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
));
|
||||
}
|
||||
|
||||
public function testLoadSingleConnection()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_single_entity_manager');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
array(
|
||||
'host' => 'localhost',
|
||||
'driver' => 'pdo_sqlite',
|
||||
'driverOptions' => array(),
|
||||
'user' => 'sqlite_user',
|
||||
'port' => null,
|
||||
'password' => 'sqlite_s3cr3t',
|
||||
'dbname' => 'sqlite_db',
|
||||
'memory' => true,
|
||||
),
|
||||
new Reference('doctrine.dbal.default_connection.configuration'),
|
||||
new Reference('doctrine.dbal.default_connection.event_manager'),
|
||||
array(),
|
||||
));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
new Reference('doctrine.dbal.default_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
));
|
||||
|
||||
$configDef = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($configDef, 'setDefaultRepositoryClassName', array('Acme\Doctrine\Repository'));
|
||||
}
|
||||
|
||||
public function testLoadMultipleConnections()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_multiple_entity_managers');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.conn1_connection');
|
||||
|
||||
$args = $definition->getArguments();
|
||||
$this->assertEquals('pdo_sqlite', $args[0]['driver']);
|
||||
$this->assertEquals('localhost', $args[0]['host']);
|
||||
$this->assertEquals('sqlite_user', $args[0]['user']);
|
||||
$this->assertEquals('doctrine.dbal.conn1_connection.configuration', (string) $args[1]);
|
||||
$this->assertEquals('doctrine.dbal.conn1_connection.event_manager', (string) $args[2]);
|
||||
|
||||
$this->assertEquals('doctrine.orm.em2_entity_manager', (string) $container->getAlias('doctrine.orm.entity_manager'));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$arguments = $definition->getArguments();
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]);
|
||||
$this->assertEquals('doctrine.dbal.conn1_connection', (string) $arguments[0]);
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.em1_configuration', (string) $arguments[1]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.conn2_connection');
|
||||
|
||||
$args = $definition->getArguments();
|
||||
$this->assertEquals('pdo_sqlite', $args[0]['driver']);
|
||||
$this->assertEquals('localhost', $args[0]['host']);
|
||||
$this->assertEquals('sqlite_user', $args[0]['user']);
|
||||
$this->assertEquals('doctrine.dbal.conn2_connection.configuration', (string) $args[1]);
|
||||
$this->assertEquals('doctrine.dbal.conn2_connection.event_manager', (string) $args[2]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em2_entity_manager');
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass());
|
||||
$this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getFactoryClass());
|
||||
$this->assertEquals('create', $definition->getFactoryMethod());
|
||||
|
||||
$arguments = $definition->getArguments();
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]);
|
||||
$this->assertEquals('doctrine.dbal.conn2_connection', (string) $arguments[0]);
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.em2_configuration', (string) $arguments[1]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_metadata_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.xcache.class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_query_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_result_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array.class%', $definition->getClass());
|
||||
}
|
||||
|
||||
public function testLoadLogging()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'dbal_logging');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.log_connection.configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', array(new Reference('doctrine.dbal.logger')));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.profile_connection.configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', array(new Reference('doctrine.dbal.logger.chain.profile')));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.both_connection.configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', array(new Reference('doctrine.dbal.logger.chain.both')));
|
||||
}
|
||||
|
||||
public function testBundleEntityAliases()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setEntityNamespaces',
|
||||
array(array('YamlBundle' => 'Fixtures\Bundles\YamlBundle\Entity'))
|
||||
);
|
||||
}
|
||||
|
||||
public function testOverwriteEntityAliases()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array('alias' => 'yml')))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setEntityNamespaces',
|
||||
array(array('yml' => 'Fixtures\Bundles\YamlBundle\Entity'))
|
||||
);
|
||||
}
|
||||
|
||||
public function testYamlBundleMappingDetection()
|
||||
{
|
||||
$container = $this->getContainer('YamlBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_yml_metadata_driver'),
|
||||
'Fixtures\Bundles\YamlBundle\Entity'
|
||||
));
|
||||
}
|
||||
|
||||
public function testXmlBundleMappingDetection()
|
||||
{
|
||||
$container = $this->getContainer('XmlBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('XmlBundle' => array()))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_xml_metadata_driver'),
|
||||
'Fixtures\Bundles\XmlBundle\Entity'
|
||||
));
|
||||
}
|
||||
|
||||
public function testAnnotationsBundleMappingDetection()
|
||||
{
|
||||
$container = $this->getContainer('AnnotationsBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array()))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_annotation_metadata_driver'),
|
||||
'Fixtures\Bundles\AnnotationsBundle\Entity'
|
||||
));
|
||||
}
|
||||
|
||||
public function testOrmMergeConfigs()
|
||||
{
|
||||
$container = $this->getContainer(array('XmlBundle', 'AnnotationsBundle'));
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config1 = $this->getConnectionConfig();
|
||||
$config1['orm'] = array(
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array('mappings' => array('AnnotationsBundle' => array()))
|
||||
));
|
||||
$config2 = $this->getConnectionConfig();
|
||||
$config2['orm'] = array(
|
||||
'auto_generate_proxy_classes' => false,
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array('mappings' => array('XmlBundle' => array()))
|
||||
));
|
||||
$loader->load(array($config1, $config2), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallAt(0, $definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_annotation_metadata_driver'),
|
||||
'Fixtures\Bundles\AnnotationsBundle\Entity'
|
||||
));
|
||||
$this->assertDICDefinitionMethodCallAt(1, $definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_xml_metadata_driver'),
|
||||
'Fixtures\Bundles\XmlBundle\Entity'
|
||||
));
|
||||
|
||||
$configDef = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($configDef, 'setAutoGenerateProxyClasses');
|
||||
|
||||
$calls = $configDef->getMethodCalls();
|
||||
foreach ($calls as $call) {
|
||||
if ($call[0] == 'setAutoGenerateProxyClasses') {
|
||||
$this->assertFalse($container->getParameterBag()->resolveValue($call[1][0]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testEntityManagerMetadataCacheDriverConfiguration()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_multiple_entity_managers');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, '%doctrine.orm.cache.xcache.class%');
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.em2_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, '%doctrine.orm.cache.apc.class%');
|
||||
}
|
||||
|
||||
public function testEntityManagerMemcacheMetadataCacheDriverConfiguration()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_simple_single_entity_manager');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, 'Doctrine\Common\Cache\MemcacheCache');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setMemcache',
|
||||
array(new Reference('doctrine.orm.default_memcache_instance'))
|
||||
);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_memcache_instance');
|
||||
$this->assertDICDefinitionClass($definition, 'Memcache');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'connect', array(
|
||||
'localhost', '11211'
|
||||
));
|
||||
}
|
||||
|
||||
public function testDependencyInjectionImportsOverrideDefaults()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_imports');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$cacheDefinition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.apc.class%', $cacheDefinition->getClass());
|
||||
|
||||
$configDefinition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($configDefinition, 'setAutoGenerateProxyClasses', array('%doctrine.orm.auto_generate_proxy_classes%'));
|
||||
}
|
||||
|
||||
public function testSingleEntityManagerMultipleMappingBundleDefinitions()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle', 'AnnotationsBundle', 'XmlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_single_em_bundle_mappings');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(0, $definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_annotation_metadata_driver'),
|
||||
'Fixtures\Bundles\AnnotationsBundle\Entity'
|
||||
));
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(1, $definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_yml_metadata_driver'),
|
||||
'Fixtures\Bundles\YamlBundle\Entity'
|
||||
));
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(2, $definition, 'addDriver', array(
|
||||
new Reference('doctrine.orm.default_xml_metadata_driver'),
|
||||
'Fixtures\Bundles\XmlBundle'
|
||||
));
|
||||
|
||||
$annDef = $container->getDefinition('doctrine.orm.default_annotation_metadata_driver');
|
||||
$this->assertDICConstructorArguments($annDef, array(
|
||||
new Reference('doctrine.orm.metadata.annotation_reader'),
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'AnnotationsBundle'.DIRECTORY_SEPARATOR.'Entity')
|
||||
));
|
||||
|
||||
$ymlDef = $container->getDefinition('doctrine.orm.default_yml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($ymlDef, array(
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\YamlBundle\Entity')
|
||||
));
|
||||
|
||||
$xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($xmlDef, array(
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\XmlBundle')
|
||||
));
|
||||
}
|
||||
|
||||
public function testMultipleEntityManagersMappingBundleDefinitions()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle', 'AnnotationsBundle', 'XmlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_multiple_em_bundle_mappings');
|
||||
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertEquals(array('em1' => 'doctrine.orm.em1_entity_manager', 'em2' => 'doctrine.orm.em2_entity_manager'), $container->getParameter('doctrine.entity_managers'), "Set of the existing EntityManagers names is incorrect.");
|
||||
$this->assertEquals('%doctrine.entity_managers%', $container->getDefinition('doctrine')->getArgument(2), "Set of the existing EntityManagers names is incorrect.");
|
||||
|
||||
$def1 = $container->getDefinition('doctrine.orm.em1_metadata_driver');
|
||||
$def2 = $container->getDefinition('doctrine.orm.em2_metadata_driver');
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(0, $def1, 'addDriver', array(
|
||||
new Reference('doctrine.orm.em1_annotation_metadata_driver'),
|
||||
'Fixtures\Bundles\AnnotationsBundle\Entity'
|
||||
));
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(0, $def2, 'addDriver', array(
|
||||
new Reference('doctrine.orm.em2_yml_metadata_driver'),
|
||||
'Fixtures\Bundles\YamlBundle\Entity'
|
||||
));
|
||||
|
||||
$this->assertDICDefinitionMethodCallAt(1, $def2, 'addDriver', array(
|
||||
new Reference('doctrine.orm.em2_xml_metadata_driver'),
|
||||
'Fixtures\Bundles\XmlBundle'
|
||||
));
|
||||
|
||||
$annDef = $container->getDefinition('doctrine.orm.em1_annotation_metadata_driver');
|
||||
$this->assertDICConstructorArguments($annDef, array(
|
||||
new Reference('doctrine.orm.metadata.annotation_reader'),
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'AnnotationsBundle'.DIRECTORY_SEPARATOR.'Entity')
|
||||
));
|
||||
|
||||
$ymlDef = $container->getDefinition('doctrine.orm.em2_yml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($ymlDef, array(
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\YamlBundle\Entity')
|
||||
));
|
||||
|
||||
$xmlDef = $container->getDefinition('doctrine.orm.em2_xml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($xmlDef, array(
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine' => 'Fixtures\Bundles\XmlBundle')
|
||||
));
|
||||
}
|
||||
|
||||
public function testAnnotationsBundleMappingDetectionWithVendorNamespace()
|
||||
{
|
||||
$container = $this->getContainer('AnnotationsBundle', 'Vendor');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$config = $this->getConnectionConfig();
|
||||
$config['orm'] = array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array()))));
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
$calls = $container->getDefinition('doctrine.orm.default_metadata_driver')->getMethodCalls();
|
||||
$this->assertEquals('doctrine.orm.default_annotation_metadata_driver', (string) $calls[0][1][0]);
|
||||
$this->assertEquals('Fixtures\Bundles\Vendor\AnnotationsBundle\Entity', $calls[0][1][1]);
|
||||
}
|
||||
|
||||
public function testSetTypes()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$this->loadFromFile($container, 'dbal_types');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$this->assertEquals(
|
||||
array('test' => array('class' => 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType', 'commented' => true)),
|
||||
$container->getParameter('doctrine.dbal.connection_factory.types')
|
||||
);
|
||||
$this->assertEquals('%doctrine.dbal.connection_factory.types%', $container->getDefinition('doctrine.dbal.connection_factory')->getArgument(0));
|
||||
}
|
||||
|
||||
public function testSetCustomFunctions()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$this->loadFromFile($container, 'orm_functions');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomStringFunction', array('test_string', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction'));
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomNumericFunction', array('test_numeric', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestNumericFunction'));
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomDatetimeFunction', array('test_datetime', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction'));
|
||||
}
|
||||
|
||||
public function testSingleEMSetCustomFunctions()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$this->loadFromFile($container, 'orm_single_em_dql_functions');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomStringFunction', array('test_string', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction'));
|
||||
}
|
||||
|
||||
public function testAddCustomHydrationMode()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$this->loadFromFile($container, 'orm_hydration_mode');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomHydrationMode', array('test_hydrator', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator'));
|
||||
}
|
||||
|
||||
public function testAddFilter()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_filters');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addFilter', array('soft_delete', 'Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter'));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_manager_configurator');
|
||||
$this->assertDICConstructorArguments($definition, array(array('soft_delete')));
|
||||
|
||||
// Let's create the instance to check the configurator work.
|
||||
/** @var $entityManager \Doctrine\ORM\EntityManager */
|
||||
$entityManager = $container->get('doctrine.orm.entity_manager');
|
||||
$this->assertCount(1, $entityManager->getFilters()->getEnabledFilters());
|
||||
}
|
||||
|
||||
public function testResolveTargetEntity()
|
||||
{
|
||||
$container = $this->getContainer(array('YamlBundle'));
|
||||
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$this->loadFromFile($container, 'orm_resolve_target_entity');
|
||||
$this->compileContainer($container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.listeners.resolve_target_entity');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addResolveTargetEntity', array('Symfony\Component\Security\Core\User\UserInterface', 'MyUserClass', array()));
|
||||
$this->assertEquals(array('doctrine.event_listener' => array( array('event' => 'loadClassMetadata') ) ), $definition->getTags());
|
||||
}
|
||||
|
||||
protected function getContainer($bundles = 'YamlBundle', $vendor = null)
|
||||
{
|
||||
$bundles = (array) $bundles;
|
||||
|
||||
$map = array();
|
||||
foreach ($bundles as $bundle) {
|
||||
require_once __DIR__.'/Fixtures/Bundles/'.($vendor ? $vendor.'/' : '').$bundle.'/'.$bundle.'.php';
|
||||
|
||||
$map[$bundle] = 'Fixtures\\Bundles\\'.($vendor ? $vendor.'\\' : '').$bundle.'\\'.$bundle;
|
||||
}
|
||||
|
||||
return new ContainerBuilder(new ParameterBag(array(
|
||||
'kernel.debug' => false,
|
||||
'kernel.bundles' => $map,
|
||||
'kernel.cache_dir' => sys_get_temp_dir(),
|
||||
'kernel.environment' => 'test',
|
||||
'kernel.root_dir' => __DIR__.'/../../' // src dir
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assertion on the Class of a DIC Service Definition.
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\Definition $definition
|
||||
* @param string $expectedClass
|
||||
*/
|
||||
protected function assertDICDefinitionClass($definition, $expectedClass)
|
||||
{
|
||||
$this->assertEquals($expectedClass, $definition->getClass(), 'Expected Class of the DIC Container Service Definition is wrong.');
|
||||
}
|
||||
|
||||
protected function assertDICConstructorArguments($definition, $args)
|
||||
{
|
||||
$this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '".$definition->getClass()."' don't match.");
|
||||
}
|
||||
|
||||
protected function assertDICDefinitionMethodCallAt($pos, $definition, $methodName, array $params = null)
|
||||
{
|
||||
$calls = $definition->getMethodCalls();
|
||||
if (isset($calls[$pos][0])) {
|
||||
$this->assertEquals($methodName, $calls[$pos][0], "Method '".$methodName."' is expected to be called at position $pos.");
|
||||
|
||||
if ($params !== null) {
|
||||
$this->assertEquals($params, $calls[$pos][1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assertion for the DI Container, check if the given definition contains a method call with the given parameters.
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\Definition $definition
|
||||
* @param string $methodName
|
||||
* @param array $params
|
||||
*/
|
||||
protected function assertDICDefinitionMethodCallOnce($definition, $methodName, array $params = null)
|
||||
{
|
||||
$calls = $definition->getMethodCalls();
|
||||
$called = false;
|
||||
foreach ($calls as $call) {
|
||||
if ($call[0] == $methodName) {
|
||||
if ($called) {
|
||||
$this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though.");
|
||||
} else {
|
||||
$called = true;
|
||||
if ($params !== null) {
|
||||
$this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$called) {
|
||||
$this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though.");
|
||||
}
|
||||
}
|
||||
|
||||
protected function compileContainer(ContainerBuilder $container)
|
||||
{
|
||||
$container->getCompilerPassConfig()->setOptimizationPasses(array(new ResolveDefinitionTemplatesPass()));
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
protected function getConnectionConfig()
|
||||
{
|
||||
return array('dbal' => array('connections' => array('default' => array('password' => 'foo'))));
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\AnnotationsBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class AnnotationsBundle extends Bundle
|
||||
{
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\AnnotationsBundle\Entity;
|
||||
|
||||
class Test
|
||||
{
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\Vendor\AnnotationsBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class AnnotationsBundle extends Bundle
|
||||
{
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\Vendor\AnnotationsBundle\Entity;
|
||||
|
||||
class Test
|
||||
{
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\XmlBundle\Entity;
|
||||
|
||||
class Test
|
||||
{
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\XmlBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class XmlBundle extends Bundle
|
||||
{
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\YamlBundle\Entity;
|
||||
|
||||
class Test
|
||||
{
|
||||
private $id;
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
Fixtures\Bundles\YamlBundle\Entity\Test:
|
||||
type: entity
|
||||
id:
|
||||
id:
|
||||
type: integer
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Fixtures\Bundles\YamlBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class YamlBundle extends Bundle
|
||||
{
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="mysql">
|
||||
<connection
|
||||
name="log"
|
||||
logging="true"
|
||||
profiling="false" />
|
||||
<connection
|
||||
name="profile"
|
||||
logging="false"
|
||||
profiling="true" />
|
||||
<connection
|
||||
name="both"
|
||||
logging="true"
|
||||
profiling="true" />
|
||||
<connection
|
||||
name="none"
|
||||
logging="false"
|
||||
profiling="false" />
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="mysql">
|
||||
<connection
|
||||
name="mysql"
|
||||
dbname="mysql_db"
|
||||
user="mysql_user"
|
||||
password="mysql_s3cr3t"
|
||||
unix-socket="/path/to/mysqld.sock" /><!-- -->
|
||||
<connection
|
||||
name="sqlite"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
<connection
|
||||
name="oci"
|
||||
driver="oci8"
|
||||
dbname="oracle_db"
|
||||
user="oracle_user"
|
||||
password="oracle_s3cr3t"
|
||||
charset="utf8" />
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal dbname="mysql_db" user="mysql_user" password="mysql_s3cr3t" unix-socket="/path/to/mysqld.sock" />
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal dbname="mysql_db" user="mysql_user" password="mysql_s3cr3t" unix-socket="/path/to/mysqld.sock">
|
||||
<slave name="slave1" dbname="slave_db" user="slave_user" password="slave_s3cr3t" unix-socket="/path/to/mysqld_slave.sock" />
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<type name="test">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType</type>
|
||||
<connection name="default" />
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm>
|
||||
<filter name="soft_delete" enabled="true">Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter</filter>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="default">
|
||||
<entity-manager name="default">
|
||||
<mapping name="YamlBundle" />
|
||||
<dql>
|
||||
<string-function name="test_string">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction</string-function>
|
||||
<numeric-function name="test_numeric">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestNumericFunction</numeric-function>
|
||||
<datetime-function name="test_datetime">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction</datetime-function>
|
||||
</dql>
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="default">
|
||||
<entity-manager name="default">
|
||||
<hydrator name="test_hydrator">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator</hydrator>
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<srv:imports>
|
||||
<srv:import resource="orm_imports_import.xml" />
|
||||
</srv:imports>
|
||||
|
||||
<config>
|
||||
<orm auto-generate-proxy-classes="true" />
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm
|
||||
auto-generate-proxy-classes="false"
|
||||
default-entity-manager="default"
|
||||
>
|
||||
<entity-manager name="default" metadata-cache-driver="apc">
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="em2">
|
||||
<entity-manager name="em1">
|
||||
<mapping name="AnnotationsBundle" />
|
||||
</entity-manager>
|
||||
<entity-manager name="em2">
|
||||
<mapping name="YamlBundle" dir="Resources/config/doctrine" alias="yml" />
|
||||
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
|
||||
dir="%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
|
||||
alias="TestAlias"
|
||||
/>
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<orm proxy-dir="%kernel.cache_dir%/doctrine" proxy-namespace="DCProxy" />
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="default">
|
||||
<resolve-target-entity interface="Symfony\Component\Security\Core\User\UserInterface">MyUserClass</resolve-target-entity>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<srv:parameters>
|
||||
<srv:parameter key="doctrine.orm.proxy_namespace">Proxies</srv:parameter>
|
||||
</srv:parameters>
|
||||
|
||||
<config>
|
||||
<dbal default-connection="conn1">
|
||||
<connection
|
||||
name="conn1"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
<connection
|
||||
name="conn2"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="em2" auto-generate-proxy-classes="true">
|
||||
<entity-manager name="em1" metadata-cache-driver="xcache" connection="conn1">
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
<entity-manager name="em2" connection="conn2" metadata-cache-driver="apc">
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm default-entity-manager="default">
|
||||
<entity-manager name="default">
|
||||
<metadata-cache-driver type="memcache">
|
||||
<class>Doctrine\Common\Cache\MemcacheCache</class>
|
||||
<host>localhost</host>
|
||||
<port>11211</port>
|
||||
<instance-class>Memcache</instance-class>
|
||||
</metadata-cache-driver>
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<srv:parameters>
|
||||
<srv:parameter key="doctrine.orm.proxy_namespace">Proxies</srv:parameter>
|
||||
</srv:parameters>
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection
|
||||
name="default"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
</dbal>
|
||||
|
||||
<orm
|
||||
default-entity-manager="default"
|
||||
auto-generate-proxy-classes="true"
|
||||
>
|
||||
<entity-manager name="default" connection="default" default-repository-class="Acme\Doctrine\Repository">
|
||||
<metadata-cache-driver type="memcache">
|
||||
<class>Doctrine\Common\Cache\MemcacheCache</class>
|
||||
<host>localhost</host>
|
||||
<port>11211</port>
|
||||
<instance-class>Memcache</instance-class>
|
||||
</metadata-cache-driver>
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm>
|
||||
<mapping name="AnnotationsBundle" />
|
||||
<mapping name="YamlBundle" dir="Resources/config/doctrine" alias="yml" />
|
||||
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
|
||||
dir="%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
|
||||
alias="TestAlias"
|
||||
/>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<srv:container xmlns="http://symfony.com/schema/dic/doctrine"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:srv="http://symfony.com/schema/dic/services"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal default-connection="default">
|
||||
<connection name="default" dbname="db" />
|
||||
</dbal>
|
||||
|
||||
<orm>
|
||||
<dql>
|
||||
<string-function name="test_string">Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction</string-function>
|
||||
</dql>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
@@ -0,0 +1,13 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: mysql
|
||||
connections:
|
||||
log:
|
||||
logging: true
|
||||
profiling: false
|
||||
profile:
|
||||
logging: false
|
||||
profiling: true
|
||||
both:
|
||||
logging: true
|
||||
profiling: true
|
@@ -0,0 +1,18 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: mysql
|
||||
connections:
|
||||
mysql:
|
||||
dbname: mysql_db
|
||||
user: mysql_user
|
||||
password: mysql_s3cr3t
|
||||
unix_socket: /path/to/mysqld.sock
|
||||
sqlite:
|
||||
driver: pdo_sqlite
|
||||
memory: true
|
||||
oci:
|
||||
driver: oci8
|
||||
dbname: oracle_db
|
||||
user: oracle_user
|
||||
password: oracle_s3cr3t
|
||||
charset: utf8
|
@@ -0,0 +1,6 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
dbname: mysql_db
|
||||
user: mysql_user
|
||||
password: mysql_s3cr3t
|
||||
unix_socket: /path/to/mysqld.sock
|
@@ -0,0 +1,12 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
dbname: mysql_db
|
||||
user: mysql_user
|
||||
password: mysql_s3cr3t
|
||||
unix_socket: /path/to/mysqld.sock
|
||||
slaves:
|
||||
slave1:
|
||||
user: slave_user
|
||||
dbname: slave_db
|
||||
password: slave_s3cr3t
|
||||
unix_socket: /path/to/mysqld_slave.sock
|
@@ -0,0 +1,7 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
types:
|
||||
test: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType
|
||||
connections:
|
||||
default: ~
|
@@ -0,0 +1,12 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
filters:
|
||||
soft_delete:
|
||||
class: Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter
|
||||
enabled: true
|
@@ -0,0 +1,19 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
entity_managers:
|
||||
default:
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
dql:
|
||||
string_functions:
|
||||
test_string: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction
|
||||
numeric_functions:
|
||||
test_numeric: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestNumericFunction
|
||||
datetime_functions:
|
||||
test_datetime: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction
|
@@ -0,0 +1,14 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
entity_managers:
|
||||
default:
|
||||
hydrators:
|
||||
test_hydrator: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestHydrator
|
||||
mappings:
|
||||
YamlBundle: ~
|
@@ -0,0 +1,6 @@
|
||||
imports:
|
||||
- { resource: orm_imports_import.yml }
|
||||
|
||||
doctrine:
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
@@ -0,0 +1,15 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
default_entity_manager: default
|
||||
entity_managers:
|
||||
default:
|
||||
metadata_cache_driver: apc
|
||||
mappings:
|
||||
YamlBundle: ~
|
@@ -0,0 +1,23 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
default_entity_manager: em2
|
||||
entity_managers:
|
||||
em1:
|
||||
mappings:
|
||||
AnnotationsBundle: ~
|
||||
em2:
|
||||
mappings:
|
||||
YamlBundle:
|
||||
dir: Resources/config/doctrine
|
||||
alias: yml
|
||||
manual:
|
||||
type: xml
|
||||
prefix: Fixtures\Bundles\XmlBundle
|
||||
dir: %kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine
|
||||
alias: TestAlias
|
@@ -0,0 +1,10 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
resolve_target_entities:
|
||||
Symfony\Component\Security\Core\User\UserInterface: MyUserClass
|
@@ -0,0 +1,34 @@
|
||||
parameters:
|
||||
doctrine.orm.proxy_namespace: Proxies
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: conn1
|
||||
connections:
|
||||
conn1:
|
||||
driver: pdo_sqlite
|
||||
dbname: sqlite_db
|
||||
user: sqlite_user
|
||||
password: sqlite_s3cr3t
|
||||
memory: true
|
||||
conn2:
|
||||
driver: pdo_sqlite
|
||||
dbname: sqlite_db
|
||||
user: sqlite_user
|
||||
password: sqlite_s3cr3t
|
||||
memory: true
|
||||
|
||||
orm:
|
||||
default_entity_manager: em2
|
||||
auto_generate_proxy_classes: true
|
||||
entity_managers:
|
||||
em1:
|
||||
metadata_cache_driver: xcache
|
||||
connection: conn1
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
em2:
|
||||
metadata_cache_driver: apc
|
||||
connection: conn2
|
||||
mappings:
|
||||
YamlBundle: ~
|
@@ -0,0 +1,19 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
default_entity_manager: default
|
||||
entity_managers:
|
||||
default:
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
@@ -0,0 +1,27 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
driver: pdo_sqlite
|
||||
dbname: sqlite_db
|
||||
user: sqlite_user
|
||||
password: sqlite_s3cr3t
|
||||
memory: true
|
||||
|
||||
orm:
|
||||
default_entity_manager: dm2
|
||||
proxy_namespace: Proxies
|
||||
auto_generate_proxy_classes: true
|
||||
entity_managers:
|
||||
default:
|
||||
connection: default
|
||||
default_repository_class: Acme\Doctrine\Repository
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
@@ -0,0 +1,18 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
mappings:
|
||||
AnnotationsBundle: ~
|
||||
YamlBundle:
|
||||
dir: Resources/config/doctrine
|
||||
alias: yml
|
||||
manual:
|
||||
type: xml
|
||||
prefix: Fixtures\Bundles\XmlBundle
|
||||
dir: %kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine
|
||||
alias: TestAlias
|
@@ -0,0 +1,11 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
dbname: db
|
||||
|
||||
orm:
|
||||
dql:
|
||||
string_functions:
|
||||
test_string: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
|
||||
class TestDatetimeFunction extends FunctionNode
|
||||
{
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function parse(Parser $parser)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\ORM\Query\Filter\SQLFilter;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
|
||||
class TestFilter extends SQLFilter
|
||||
{
|
||||
/**
|
||||
* Gets the SQL query part to add to a query.
|
||||
*
|
||||
* @return string The constraint SQL if there is available, empty string otherwise
|
||||
*/
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
|
||||
class TestNumericFunction extends FunctionNode
|
||||
{
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function parse(Parser $parser)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
|
||||
class TestStringFunction extends FunctionNode
|
||||
{
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function parse(Parser $parser)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
class TestType extends \Doctrine\DBAL\Types\Type
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'test';
|
||||
}
|
||||
|
||||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
class XMLSchemaTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
static public function dataValidateSchemaFiles()
|
||||
{
|
||||
$schemaFiles = array();
|
||||
$di = new \DirectoryIterator(__DIR__."/Fixtures/config/xml");
|
||||
foreach ($di as $element) {
|
||||
if ($element->isFile() && substr($element->getFilename(), -4) === ".xml") {
|
||||
$schemaFiles[] = array($element->getPathname());
|
||||
}
|
||||
}
|
||||
|
||||
return $schemaFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataValidateSchemaFiles
|
||||
*/
|
||||
public function testValidateSchema($file)
|
||||
{
|
||||
$found = false;
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->load($file);
|
||||
|
||||
|
||||
$dbalElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config");
|
||||
if ($dbalElements->length) {
|
||||
$dbalDom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dbalNode = $dbalDom->importNode($dbalElements->item(0));
|
||||
$dbalDom->appendChild($dbalNode);
|
||||
|
||||
$ret = $dbalDom->schemaValidate(__DIR__."/../../Resources/config/schema/doctrine-1.0.xsd");
|
||||
$this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.");
|
||||
$found = true;
|
||||
}
|
||||
|
||||
$ormElements = $dom->getElementsByTagNameNS("http://symfony.com/schema/dic/doctrine", "config");
|
||||
if ($ormElements->length) {
|
||||
$ormDom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$ormNode = $ormDom->importNode($ormElements->item(0));
|
||||
$ormDom->appendChild($ormNode);
|
||||
|
||||
$ret = $ormDom->schemaValidate(__DIR__."/../../Resources/config/schema/doctrine-1.0.xsd");
|
||||
$this->assertTrue($ret, "DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.");
|
||||
$found = true;
|
||||
}
|
||||
|
||||
$this->assertTrue($found, "Neither <doctrine:orm> nor <doctrine:dbal> elements found in given XML. Are namespaces configured correctly?");
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class XmlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
||||
{
|
||||
protected function loadFromFile(ContainerBuilder $container, $file)
|
||||
{
|
||||
$loadXml = new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/config/xml'));
|
||||
$loadXml->load($file.'.xml');
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class YamlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
||||
{
|
||||
protected function loadFromFile(ContainerBuilder $container, $file)
|
||||
{
|
||||
$loadYaml = new YamlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/config/yml'));
|
||||
$loadYaml->load($file.'.yml');
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests;
|
||||
|
||||
use Doctrine\Bundle\DoctrineBundle\Tests\TestCase;
|
||||
use Doctrine\Bundle\DoctrineBundle\Mapping\MetadataFactory;
|
||||
use Doctrine\Bundle\DoctrineBundle\Mapping\ClassMetadataCollection;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
|
||||
class MetadataFactoryTest extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (!class_exists('Doctrine\\ORM\\Version')) {
|
||||
$this->markTestSkipped('Doctrine ORM is not available.');
|
||||
}
|
||||
}
|
||||
|
||||
public function testFindNamespaceAndPathForMetadata()
|
||||
{
|
||||
$class = new ClassMetadataInfo(__CLASS__);
|
||||
$collection = new ClassMetadataCollection(array($class));
|
||||
|
||||
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$factory = new MetadataFactory($registry);
|
||||
|
||||
$this->setExpectedException("RuntimeException", "Can't find base path for \"Doctrine\Bundle\DoctrineBundle\Tests\MetadataFactoryTest");
|
||||
$factory->findNamespaceAndPathForMetadata($collection);
|
||||
}
|
||||
}
|
149
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/RegistryTest.php
vendored
Normal file
149
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/RegistryTest.php
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests;
|
||||
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
|
||||
class RegistryTest extends TestCase
|
||||
{
|
||||
public function testGetDefaultConnectionName()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array(), array(), 'default', 'default');
|
||||
|
||||
$this->assertEquals('default', $registry->getDefaultConnectionName());
|
||||
}
|
||||
|
||||
public function testGetDefaultEntityManagerName()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array(), array(), 'default', 'default');
|
||||
|
||||
$this->assertEquals('default', $registry->getDefaultEntityManagerName());
|
||||
}
|
||||
|
||||
public function testGetDefaultConnection()
|
||||
{
|
||||
$conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false);
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('doctrine.dbal.default_connection'))
|
||||
->will($this->returnValue($conn));
|
||||
|
||||
$registry = new Registry($container, array('default' => 'doctrine.dbal.default_connection'), array(), 'default', 'default');
|
||||
|
||||
$this->assertSame($conn, $registry->getConnection());
|
||||
}
|
||||
|
||||
public function testGetConnection()
|
||||
{
|
||||
$conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false);
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('doctrine.dbal.default_connection'))
|
||||
->will($this->returnValue($conn));
|
||||
|
||||
$registry = new Registry($container, array('default' => 'doctrine.dbal.default_connection'), array(), 'default', 'default');
|
||||
|
||||
$this->assertSame($conn, $registry->getConnection('default'));
|
||||
}
|
||||
|
||||
public function testGetUnknownConnection()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array(), array(), 'default', 'default');
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException', 'Doctrine ORM Connection named "default" does not exist.');
|
||||
$registry->getConnection('default');
|
||||
}
|
||||
|
||||
public function testGetConnectionNames()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array('default' => 'doctrine.dbal.default_connection'), array(), 'default', 'default');
|
||||
|
||||
$this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $registry->getConnectionNames());
|
||||
}
|
||||
|
||||
public function testGetDefaultEntityManager()
|
||||
{
|
||||
$em = new \stdClass();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('doctrine.orm.default_entity_manager'))
|
||||
->will($this->returnValue($em));
|
||||
|
||||
$registry = new Registry($container, array(), array('default' => 'doctrine.orm.default_entity_manager'), 'default', 'default');
|
||||
|
||||
$this->assertSame($em, $registry->getEntityManager());
|
||||
}
|
||||
|
||||
public function testGetEntityManager()
|
||||
{
|
||||
$em = new \stdClass();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->equalTo('doctrine.orm.default_entity_manager'))
|
||||
->will($this->returnValue($em));
|
||||
|
||||
$registry = new Registry($container, array(), array('default' => 'doctrine.orm.default_entity_manager'), 'default', 'default');
|
||||
|
||||
$this->assertSame($em, $registry->getEntityManager('default'));
|
||||
}
|
||||
|
||||
public function testGetUnknownEntityManager()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array(), array(), 'default', 'default');
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException', 'Doctrine ORM Manager named "default" does not exist.');
|
||||
$registry->getEntityManager('default');
|
||||
}
|
||||
|
||||
public function testResetDefaultEntityManager()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('set')
|
||||
->with($this->equalTo('doctrine.orm.default_entity_manager'), $this->equalTo(null));
|
||||
|
||||
$registry = new Registry($container, array(), array('default' => 'doctrine.orm.default_entity_manager'), 'default', 'default');
|
||||
$registry->resetEntityManager();
|
||||
}
|
||||
|
||||
public function testResetEntityManager()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('set')
|
||||
->with($this->equalTo('doctrine.orm.default_entity_manager'), $this->equalTo(null));
|
||||
|
||||
$registry = new Registry($container, array(), array('default' => 'doctrine.orm.default_entity_manager'), 'default', 'default');
|
||||
$registry->resetEntityManager('default');
|
||||
}
|
||||
|
||||
public function testResetUnknownEntityManager()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$registry = new Registry($container, array(), array(), 'default', 'default');
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException', 'Doctrine ORM Manager named "default" does not exist.');
|
||||
$registry->resetEntityManager('default');
|
||||
}
|
||||
}
|
83
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/TestCase.php
vendored
Normal file
83
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/TestCase.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Doctrine Bundle
|
||||
*
|
||||
* The code was originally distributed inside the Symfony framework.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
* (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Bundle\DoctrineBundle\Tests;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
|
||||
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
|
||||
|
||||
class TestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
if (!class_exists('Doctrine\\Common\\Version')) {
|
||||
$this->markTestSkipped('Doctrine is not available.');
|
||||
}
|
||||
}
|
||||
|
||||
public function createYamlBundleTestContainer()
|
||||
{
|
||||
$container = new ContainerBuilder(new ParameterBag(array(
|
||||
'kernel.debug' => false,
|
||||
'kernel.bundles' => array('YamlBundle' => 'Fixtures\Bundles\YamlBundle\YamlBundle'),
|
||||
'kernel.cache_dir' => sys_get_temp_dir(),
|
||||
'kernel.environment' => 'test',
|
||||
'kernel.root_dir' => __DIR__.'/../../../../' // src dir
|
||||
)));
|
||||
$container->set('annotation_reader', new AnnotationReader());
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$loader->load(array(array(
|
||||
'dbal' => array(
|
||||
'connections' => array(
|
||||
'default' => array(
|
||||
'driver' => 'pdo_mysql',
|
||||
'charset' => 'UTF8',
|
||||
'platform-service' => 'my.platform',
|
||||
)
|
||||
),
|
||||
'default_connection' => 'default',
|
||||
'types' => array(
|
||||
'test' => 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType',
|
||||
),
|
||||
), 'orm' => array(
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array (
|
||||
'default' => array(
|
||||
'mappings' => array('YamlBundle' => array(
|
||||
'type' => 'yml',
|
||||
'dir' => __DIR__.'/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine',
|
||||
'prefix' => 'Fixtures\Bundles\YamlBundle\Entity',
|
||||
)
|
||||
))),
|
||||
'resolve_target_entities' => array(
|
||||
'Symfony\Component\Security\Core\User\UserInterface' => 'stdClass',
|
||||
),
|
||||
)
|
||||
)), $container);
|
||||
|
||||
$container->setDefinition('my.platform', new \Symfony\Component\DependencyInjection\Definition('Doctrine\DBAL\Platforms\MySqlPlatform'));
|
||||
|
||||
$container->getCompilerPassConfig()->setOptimizationPasses(array(new ResolveDefinitionTemplatesPass()));
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
$container->compile();
|
||||
|
||||
return $container;
|
||||
}
|
||||
}
|
8
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/bootstrap.php
vendored
Normal file
8
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (!@include __DIR__ . '/../vendor/autoload.php') {
|
||||
die("You must set up the project dependencies, run the following commands:
|
||||
wget http://getcomposer.org/composer.phar
|
||||
php composer.phar install --dev
|
||||
");
|
||||
}
|
45
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json
vendored
Normal file
45
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/composer.json
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "doctrine/doctrine-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "Symfony DoctrineBundle",
|
||||
"keywords": ["DBAL", "ORM", "Database", "Persistence"],
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"symfony/framework-bundle": "2.1.*",
|
||||
"symfony/doctrine-bridge": "2.1.*",
|
||||
"doctrine/dbal": ">=2.2,<2.4-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/orm": ">=2.2,<2.4-dev",
|
||||
"symfony/yaml": "2.1.*",
|
||||
"symfony/validator": "2.1.*"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/orm": "The Doctrine ORM integration is optional in the bundle."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Doctrine\\Bundle\\DoctrineBundle": "" }
|
||||
},
|
||||
"target-dir": "Doctrine/Bundle/DoctrineBundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
35
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/phpunit.xml.dist
vendored
Normal file
35
vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="Tests/bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="DoctrineBundle for the Symfony Framework">
|
||||
<directory>./Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>benchmark</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>.</directory>
|
||||
<exclude>
|
||||
<directory>./Resources</directory>
|
||||
<directory>./Tests</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
Reference in New Issue
Block a user