Merge remote branch 'symfony/master' into event-manager
Conflicts: src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventManager.php src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php src/Symfony/Component/Security/Http/Firewall.php src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php src/Symfony/Component/Security/Http/Firewall/AccessListener.php src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/ChannelListener.php src/Symfony/Component/Security/Http/Firewall/ContextListener.php src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php src/Symfony/Component/Security/Http/Firewall/LogoutListener.php src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php tests/Symfony/Tests/Component/Security/Http/Firewall/RememberMeListenerTest.php
This commit is contained in:
commit
25931caeab
@ -29,7 +29,7 @@ Documentation
|
||||
Symfony 2.0 is still in the early stages of development, but the
|
||||
"[Quick Tour][1]" tutorial can get you started fast.
|
||||
|
||||
The "Quick Tour" tutorial barely scratches the surface of Symfony 2.0 but it
|
||||
The "Quick Tour" tutorial barely scratches the surface of Symfony 2.0, but it
|
||||
gives you a first feeling of the framework. If, like us, you think that
|
||||
Symfony2 can help speed up your development and take the quality of your work
|
||||
to the next level, visit the official [Symfony2 website][2] to learn more.
|
@ -35,7 +35,7 @@ class DumpCommand extends Command
|
||||
->setName('assetic:dump')
|
||||
->setDescription('Dumps all assets to the filesystem')
|
||||
->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
|
||||
->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second')
|
||||
->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second, debug mode only')
|
||||
;
|
||||
}
|
||||
|
||||
@ -73,6 +73,10 @@ class DumpCommand extends Command
|
||||
*/
|
||||
protected function watch(LazyAssetManager $am, $basePath, OutputInterface $output, $debug = false)
|
||||
{
|
||||
if (!$debug) {
|
||||
throw new \RuntimeException('The --watch option is only available in debug mode.');
|
||||
}
|
||||
|
||||
$refl = new \ReflectionClass('Assetic\\AssetManager');
|
||||
$prop = $refl->getProperty('assets');
|
||||
$prop->setAccessible(true);
|
||||
@ -95,9 +99,7 @@ class DumpCommand extends Command
|
||||
|
||||
// reset the asset manager
|
||||
$prop->setValue($am, array());
|
||||
if ($debug) {
|
||||
$am->load();
|
||||
}
|
||||
$am->load();
|
||||
|
||||
file_put_contents($cache, serialize($previously));
|
||||
$error = '';
|
||||
|
@ -43,19 +43,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
||||
protected function loadMappingInformation(array $objectManager, $container)
|
||||
{
|
||||
if (isset($objectManager['mappings'])) {
|
||||
// fix inconsistency between yaml and xml naming
|
||||
if (isset($objectManager['mappings']['mapping'])) {
|
||||
if (isset($objectManager['mappings']['mapping'][0])) {
|
||||
$objectManager['mappings'] = $objectManager['mappings']['mapping'];
|
||||
} else {
|
||||
$objectManager['mappings'] = array($objectManager['mappings']['mapping']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($objectManager['mappings'] as $mappingName => $mappingConfig) {
|
||||
if (is_string($mappingConfig)) {
|
||||
$mappingConfig = array('type' => $mappingConfig);
|
||||
}
|
||||
if (!isset($mappingConfig['dir'])) {
|
||||
$mappingConfig['dir'] = false;
|
||||
}
|
||||
@ -75,12 +63,6 @@ abstract class AbstractDoctrineExtension extends Extension
|
||||
$mappingConfig['is_bundle'] = !file_exists($mappingConfig['dir']);
|
||||
}
|
||||
|
||||
if (isset($mappingConfig['name'])) {
|
||||
$mappingName = $mappingConfig['name'];
|
||||
} else if ($mappingConfig === null) {
|
||||
$mappingConfig = array();
|
||||
}
|
||||
|
||||
if ($mappingConfig['is_bundle']) {
|
||||
$bundle = null;
|
||||
foreach ($container->getParameter('kernel.bundles') as $name => $class) {
|
||||
|
@ -46,7 +46,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ abstract class DoctrineCommand extends Command
|
||||
protected function findBundle($bundleName)
|
||||
{
|
||||
$foundBundle = false;
|
||||
foreach ($this->application->getKernel()->getBundles() as $bundle) {
|
||||
foreach ($this->getApplication()->getKernel()->getBundles() as $bundle) {
|
||||
/* @var $bundle Bundle */
|
||||
if (strtolower($bundleName) == strtolower($bundle->getName())) {
|
||||
$foundBundle = $bundle;
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ EOT
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$bundle = $this->application->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
|
||||
$entity = $input->getArgument('entity');
|
||||
$fullEntityClassName = $bundle->getNamespace().'\\Entity\\'.$entity;
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$bundle = $this->application->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
|
||||
|
||||
$destPath = $bundle->getPath();
|
||||
$type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml';
|
||||
|
@ -68,7 +68,7 @@ EOT
|
||||
$paths = is_array($dirOrFile) ? $dirOrFile : array($dirOrFile);
|
||||
} else {
|
||||
$paths = array();
|
||||
foreach ($this->application->getKernel()->getBundles() as $bundle) {
|
||||
foreach ($this->getApplication()->getKernel()->getBundles() as $bundle) {
|
||||
$paths[] = $bundle->getPath().'/DataFixtures/ORM';
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationConnection($this->application, $input->getOption('connection'));
|
||||
DoctrineCommand::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\DoctrineBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
private $kernelDebug;
|
||||
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @param Boolean $kernelDebug
|
||||
* @return \Symfony\Component\Config\Definition\NodeInterface
|
||||
*/
|
||||
public function getConfigTree($kernelDebug)
|
||||
{
|
||||
$this->kernelDebug = (bool) $kernelDebug;
|
||||
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('doctrine', 'array');
|
||||
|
||||
$this->addDbalSection($rootNode);
|
||||
$this->addOrmSection($rootNode);
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
}
|
||||
|
||||
private function addDbalSection(NodeBuilder $node)
|
||||
{
|
||||
$node
|
||||
->arrayNode('dbal')
|
||||
->beforeNormalization()
|
||||
->ifNull()
|
||||
// Define a default connection using the default values
|
||||
->then(function($v) { return array ('default_connection' => 'default', 'connections' => array('default' => array())); })
|
||||
->end()
|
||||
->scalarNode('default_connection')->isRequired()->cannotBeEmpty()->end()
|
||||
->fixXmlConfig('type')
|
||||
->arrayNode('types')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('scalar')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function($v) { return is_array($v) && isset($v['class']); })
|
||||
->then(function($v) { return $v['class']; })
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->fixXmlConfig('connection')
|
||||
->builder($this->getDbalConnectionsNode())
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function getDbalConnectionsNode()
|
||||
{
|
||||
$node = new NodeBuilder('connections', 'array');
|
||||
$node
|
||||
->requiresAtLeastOneElement()
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->scalarNode('dbname')->end()
|
||||
->scalarNode('host')->defaultValue('localhost')->end()
|
||||
->scalarNode('port')->defaultNull()->end()
|
||||
->scalarNode('user')->defaultValue('root')->end()
|
||||
->scalarNode('password')->defaultNull()->end()
|
||||
->scalarNode('driver')->defaultValue('pdo_mysql')->end()
|
||||
->fixXmlConfig('driver_class', 'driverClass')
|
||||
->scalarNode('driver_class')->end()
|
||||
->fixXmlConfig('options', 'driverOptions')
|
||||
->arrayNode('driverOptions')
|
||||
->useAttributeAsKey('key')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->scalarNode('path')->end()
|
||||
->booleanNode('memory')->end()
|
||||
->scalarNode('unix_socket')->end()
|
||||
->fixXmlConfig('wrapper_class', 'wrapperClass')
|
||||
->scalarNode('wrapper_class')->end()
|
||||
->scalarNode('platform_service')->end()
|
||||
->scalarNode('charset')->end()
|
||||
->booleanNode('logging')->defaultValue($this->kernelDebug)->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function addOrmSection(NodeBuilder $node)
|
||||
{
|
||||
$node
|
||||
->arrayNode('orm')
|
||||
->scalarNode('default_entity_manager')->isRequired()->cannotBeEmpty()->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()
|
||||
->fixXmlConfig('entity_manager')
|
||||
->builder($this->getOrmEntityManagersNode())
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function getOrmEntityManagersNode()
|
||||
{
|
||||
$node = new NodeBuilder('entity_managers', 'array');
|
||||
$node
|
||||
->requiresAtLeastOneElement()
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->addDefaultsIfNotSet()
|
||||
->builder($this->getOrmCacheDriverNode('query_cache_driver'))
|
||||
->builder($this->getOrmCacheDriverNode('metadata_cache_driver'))
|
||||
->builder($this->getOrmCacheDriverNode('result_cache_driver'))
|
||||
->scalarNode('connection')->end()
|
||||
->scalarNode('class_metadata_factory_name')->defaultValue('%doctrine.orm.class_metadata_factory_name%')->end()
|
||||
->fixXmlConfig('mapping')
|
||||
->arrayNode('mappings')
|
||||
->isRequired()
|
||||
->requiresAtLeastOneElement()
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array ('type' => $v); })
|
||||
->end()
|
||||
->treatNullLike(array ())
|
||||
->scalarNode('type')->end()
|
||||
->scalarNode('dir')->end()
|
||||
->scalarNode('alias')->end()
|
||||
->scalarNode('prefix')->end()
|
||||
->booleanNode('is_bundle')->end()
|
||||
->performNoDeepMerging()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function getOrmCacheDriverNode($name)
|
||||
{
|
||||
$node = new NodeBuilder($name, 'array');
|
||||
$node
|
||||
->addDefaultsIfNotSet()
|
||||
->beforeNormalization()
|
||||
->ifString()
|
||||
->then(function($v) { return array ('type' => $v); })
|
||||
->end()
|
||||
->scalarNode('type')->defaultValue('array')->isRequired()->end()
|
||||
->scalarNode('host')->end()
|
||||
->scalarNode('port')->end()
|
||||
->scalarNode('instance_class')->end()
|
||||
->scalarNode('class')->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Bundle\DoctrineBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
@ -20,6 +19,7 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
/**
|
||||
* DoctrineExtension is an extension for the Doctrine DBAL and ORM library.
|
||||
@ -32,23 +32,16 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$dbal = $orm = array();
|
||||
foreach ($configs as $config) {
|
||||
if (isset($config['dbal'])) {
|
||||
$dbal[] = $config['dbal'];
|
||||
}
|
||||
$configuration = new Configuration();
|
||||
$processor = new Processor();
|
||||
$config = $processor->process($configuration->getConfigTree($container->getParameter('kernel.debug')), $configs);
|
||||
|
||||
if (isset($config['orm'])) {
|
||||
$orm[] = $config['orm'];
|
||||
}
|
||||
if (!empty($config['dbal'])) {
|
||||
$this->dbalLoad($config['dbal'], $container);
|
||||
}
|
||||
|
||||
if (!empty($dbal)) {
|
||||
$this->dbalLoad($dbal, $container);
|
||||
}
|
||||
|
||||
if (!empty($orm)) {
|
||||
$this->ormLoad($orm, $container);
|
||||
if (!empty($config['orm'])) {
|
||||
$this->ormLoad($config['orm'], $container);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,183 +55,74 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function dbalLoad(array $configs, ContainerBuilder $container)
|
||||
protected function dbalLoad(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('dbal.xml');
|
||||
|
||||
$config = $this->mergeDbalConfig($configs, $container);
|
||||
|
||||
$container->setAlias('database_connection', sprintf('doctrine.dbal.%s_connection', $config['default_connection']));
|
||||
$container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $config['default_connection']), false));
|
||||
$container->setParameter('doctrine.dbal.default_connection', $config['default_connection']);
|
||||
$container->setParameter('doctrine.dbal.types', $config['types']);
|
||||
|
||||
foreach ($config['connections'] as $name => $connection) {
|
||||
$this->loadDbalConnection($connection, $container);
|
||||
$this->loadDbalConnection($name, $connection, $container);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges a set of exclusive independent DBAL configurations into another.
|
||||
*
|
||||
* Beginning from the default settings this method acts as incremental merge
|
||||
* of all the configurations that are passed through multiple environment
|
||||
* and fallbacks for example config.yml + config_dev.yml
|
||||
*
|
||||
* @param array $configs
|
||||
* @return array
|
||||
*/
|
||||
protected function mergeDbalConfig(array $configs, $container)
|
||||
{
|
||||
$supportedConnectionParams = array(
|
||||
'dbname' => 'dbname',
|
||||
'host' => 'host',
|
||||
'port' => 'port',
|
||||
'user' => 'user',
|
||||
'password' => 'password',
|
||||
'driver' => 'driver',
|
||||
'driver-class' => 'driverClass', // doctrine conv.
|
||||
'options' => 'driverOptions', // doctrine conv.
|
||||
'path' => 'path',
|
||||
'unix-socket' => 'unix_socket',
|
||||
'memory' => 'memory',
|
||||
'driver_class' => 'driverClass', // doctrine conv.
|
||||
'unix_socket' => 'unix_socket',
|
||||
'wrapper_class' => 'wrapperClass', // doctrine conv.
|
||||
'wrapper-class' => 'wrapperClass', // doctrine conv.
|
||||
'charset' => 'charset',
|
||||
);
|
||||
$supportedContainerParams = array(
|
||||
'platform-service' => 'platform_service',
|
||||
'platform_service' => 'platform_service',
|
||||
'logging' => 'logging',
|
||||
);
|
||||
$mergedConfig = array(
|
||||
'default_connection' => 'default',
|
||||
'types' => array(),
|
||||
);
|
||||
$connectionDefaults = array(
|
||||
'driver' => array(
|
||||
'host' => 'localhost',
|
||||
'driver' => 'pdo_mysql',
|
||||
'driverOptions' => array(),
|
||||
'user' => 'root',
|
||||
'password' => null,
|
||||
'port' => null,
|
||||
),
|
||||
'container' => array(
|
||||
'logging' => (bool)$container->getParameter('doctrine.dbal.logging')
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($configs as $config) {
|
||||
if (isset($config['default-connection'])) {
|
||||
$mergedConfig['default_connection'] = $config['default-connection'];
|
||||
} else if (isset($config['default_connection'])) {
|
||||
$mergedConfig['default_connection'] = $config['default_connection'];
|
||||
}
|
||||
|
||||
// Handle DBAL Types
|
||||
if (isset($config['types'])) {
|
||||
if (isset($config['types']['type'][0])) {
|
||||
$config['types'] = $config['types']['type'];
|
||||
}
|
||||
foreach ($config['types'] AS $name => $type) {
|
||||
if (is_array($type) && isset($type['name']) && isset($type['class'])) { // xml case
|
||||
$mergedConfig['types'][$type['name']] = $type['class'];
|
||||
} else { // yml case
|
||||
$mergedConfig['types'][$name] = $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($configs as $config) {
|
||||
if (isset($config['connections'])) {
|
||||
$configConnections = $config['connections'];
|
||||
if (isset($config['connections']['connection']) && isset($config['connections']['connection'][0])) {
|
||||
$configConnections = $config['connections']['connection'];
|
||||
}
|
||||
} else {
|
||||
$configConnections[$mergedConfig['default_connection']] = $config;
|
||||
}
|
||||
|
||||
foreach ($configConnections as $name => $connection) {
|
||||
$connectionName = isset($connection['name']) ? $connection['name'] : $name;
|
||||
if (!isset($mergedConfig['connections'][$connectionName])) {
|
||||
$mergedConfig['connections'][$connectionName] = $connectionDefaults;
|
||||
}
|
||||
$mergedConfig['connections'][$connectionName]['name'] = $connectionName;
|
||||
|
||||
foreach ($connection as $k => $v) {
|
||||
if (isset($supportedConnectionParams[$k])) {
|
||||
$mergedConfig['connections'][$connectionName]['driver'][$supportedConnectionParams[$k]] = $v;
|
||||
} else if (isset($supportedContainerParams[$k])) {
|
||||
$mergedConfig['connections'][$connectionName]['container'][$supportedContainerParams[$k]] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mergedConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(array $connection, ContainerBuilder $container)
|
||||
protected function loadDbalConnection($name, array $connection, ContainerBuilder $container)
|
||||
{
|
||||
$containerDef = new Definition($container->getParameter('doctrine.dbal.configuration_class'));
|
||||
$containerDef = new Definition('%doctrine.dbal.configuration_class%');
|
||||
$containerDef->setPublic(false);
|
||||
if (isset($connection['container']['logging']) && $connection['container']['logging']) {
|
||||
if (isset($connection['logging']) && $connection['logging']) {
|
||||
$containerDef->addMethodCall('setSQLLogger', array(new Reference('doctrine.dbal.logger')));
|
||||
unset ($connection['logging']);
|
||||
}
|
||||
$container->setDefinition(sprintf('doctrine.dbal.%s_connection.configuration', $connection['name']), $containerDef);
|
||||
|
||||
$driverOptions = $connection['driver'];
|
||||
$container->setDefinition(sprintf('doctrine.dbal.%s_connection.configuration', $name), $containerDef);
|
||||
|
||||
$driverDef = new Definition('Doctrine\DBAL\Connection');
|
||||
$driverDef->setFactoryService('doctrine.dbal.connection_factory');
|
||||
$driverDef->setFactoryMethod('createConnection');
|
||||
$container->setDefinition(sprintf('doctrine.dbal.%s_connection', $connection['name']), $driverDef);
|
||||
$container->setDefinition(sprintf('doctrine.dbal.%s_connection', $name), $driverDef);
|
||||
|
||||
// event manager
|
||||
$eventManagerId = sprintf('doctrine.dbal.%s_connection.event_manager', $connection['name']);
|
||||
$eventManagerId = sprintf('doctrine.dbal.%s_connection.event_manager', $name);
|
||||
$eventManagerDef = new Definition('%doctrine.dbal.event_manager_class%');
|
||||
$eventManagerDef->setPublic(false);
|
||||
$container->setDefinition($eventManagerId, $eventManagerDef);
|
||||
|
||||
if ($container->getParameter('doctrine.dbal.default_connection') == $connection['name']) {
|
||||
$container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $connection['name']), false));
|
||||
}
|
||||
|
||||
if (isset($driverOptions['charset'])) {
|
||||
if ( (isset($driverOptions['driver']) && stripos($driverOptions['driver'], 'mysql') !== false) ||
|
||||
(isset($driverOptions['driverClass']) && stripos($driverOptions['driverClass'], 'mysql') !== false)) {
|
||||
if (isset($connection['charset'])) {
|
||||
if ( (isset($connection['driver']) && stripos($connection['driver'], 'mysql') !== false) ||
|
||||
(isset($connection['driverClass']) && stripos($connection['driverClass'], 'mysql') !== false)) {
|
||||
$mysqlSessionInit = new Definition('%doctrine.dbal.events.mysql_session_init.class%');
|
||||
$mysqlSessionInit->setArguments(array($driverOptions['charset']));
|
||||
$mysqlSessionInit->setArguments(array($connection['charset']));
|
||||
$mysqlSessionInit->setPublic(false);
|
||||
$mysqlSessionInit->addTag(sprintf('doctrine.dbal.%s_event_subscriber', $connection['name']));
|
||||
$mysqlSessionInit->addTag(sprintf('doctrine.dbal.%s_event_subscriber', $name));
|
||||
|
||||
$container->setDefinition(
|
||||
sprintf('doctrine.dbal.%s_connection.events.mysqlsessioninit', $connection['name']),
|
||||
sprintf('doctrine.dbal.%s_connection.events.mysqlsessioninit', $name),
|
||||
$mysqlSessionInit
|
||||
);
|
||||
unset($driverOptions['charset']);
|
||||
unset($connection['charset']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($connection['container']['platform_service'])) {
|
||||
$driverOptions['platform'] = new Reference($connection['container']['platform_service']);
|
||||
if (isset($connection['platform_service'])) {
|
||||
$connection['platform'] = new Reference($connection['platform_service']);
|
||||
unset ($connection['platform_service']);
|
||||
}
|
||||
|
||||
$driverDef->setArguments(array(
|
||||
$driverOptions,
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.configuration', $connection['name'])),
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.event_manager', $connection['name']))
|
||||
$connection,
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.configuration', $name)),
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection.event_manager', $name))
|
||||
));
|
||||
}
|
||||
|
||||
@ -252,149 +136,28 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function ormLoad(array $configs, ContainerBuilder $container)
|
||||
protected function ormLoad(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('orm.xml');
|
||||
|
||||
$config = $this->mergeOrmConfig($configs, $container);
|
||||
|
||||
$options = array('default_entity_manager', 'default_connection', 'auto_generate_proxy_classes');
|
||||
$options = array('default_entity_manager', 'auto_generate_proxy_classes', 'proxy_dir', 'proxy_namespace');
|
||||
foreach ($options as $key) {
|
||||
$container->setParameter('doctrine.orm.'.$key, $config[$key]);
|
||||
}
|
||||
|
||||
foreach ($config['entity_managers'] as $entityManager) {
|
||||
$this->loadOrmEntityManager($entityManager, $container);
|
||||
$container->setAlias('doctrine.orm.entity_manager', sprintf('doctrine.orm.%s_entity_manager', $config['default_entity_manager']));
|
||||
|
||||
if ($entityManager['name'] == $config['default_entity_manager']) {
|
||||
$container->setAlias(
|
||||
'doctrine.orm.entity_manager',
|
||||
sprintf('doctrine.orm.%s_entity_manager', $entityManager['name'])
|
||||
);
|
||||
}
|
||||
foreach ($config['entity_managers'] as $name => $entityManager) {
|
||||
$entityManager['name'] = $name;
|
||||
$this->loadOrmEntityManager($entityManager, $container);
|
||||
}
|
||||
|
||||
$container->setParameter('doctrine.orm.entity_managers', array_keys($config['entity_managers']));
|
||||
}
|
||||
|
||||
protected function mergeOrmConfig(array $configs, $container)
|
||||
{
|
||||
$supportedEntityManagerOptions = array(
|
||||
'metadata_cache_driver' => 'metadata_cache_driver',
|
||||
'query_cache_driver' => 'query_cache_driver',
|
||||
'result_cache_driver' => 'result_cache_driver',
|
||||
'class_metadata_factory_name' => 'class_metadata_factory_name',
|
||||
'metadata-cache-driver' => 'metadata_cache_driver',
|
||||
'query-cache-driver' => 'query_cache_driver',
|
||||
'result-cache-driver' => 'result_cache_driver',
|
||||
'class-metadata-factory-name' => 'class_metadata_factory_name',
|
||||
'connection' => 'connection'
|
||||
);
|
||||
|
||||
$mergedConfig = array(
|
||||
'default_entity_manager' => 'default',
|
||||
'default_connection' => 'default',
|
||||
'auto_generate_proxy_classes' => false,
|
||||
'entity_managers' => array(),
|
||||
);
|
||||
|
||||
$defaultManagerOptions = array(
|
||||
'proxy_dir' => $container->getParameter('doctrine.orm.proxy_dir'),
|
||||
'proxy_namespace' => $container->getParameter('doctrine.orm.proxy_namespace'),
|
||||
'auto_generate_proxy_classes' => false,
|
||||
'metadata_cache_driver' => $container->getParameter('doctrine.orm.metadata_cache_driver'),
|
||||
'query_cache_driver' => $container->getParameter('doctrine.orm.query_cache_driver'),
|
||||
'result_cache_driver' => $container->getParameter('doctrine.orm.result_cache_driver'),
|
||||
'configuration_class' => $container->getParameter('doctrine.orm.configuration_class'),
|
||||
'entity_manager_class' => $container->getParameter('doctrine.orm.entity_manager_class'),
|
||||
'class_metadata_factory_name' => $container->getParameter('doctrine.orm.class_metadata_factory_name'),
|
||||
);
|
||||
|
||||
foreach ($configs as $config) {
|
||||
if (isset($config['default-entity-manager'])) {
|
||||
$mergedConfig['default_entity_manager'] = $config['default-entity-manager'];
|
||||
} else if (isset($config['default_entity_manager'])) {
|
||||
$mergedConfig['default_entity_manager'] = $config['default_entity_manager'];
|
||||
}
|
||||
if (isset($config['default-connection'])) {
|
||||
$mergedConfig['default_connection'] = $config['default-connection'];
|
||||
} else if (isset($config['default_connection'])) {
|
||||
$mergedConfig['default_connection'] = $config['default_connection'];
|
||||
}
|
||||
if (isset($config['auto_generate_proxy_classes'])) {
|
||||
$defaultManagerOptions['auto_generate_proxy_classes'] = $config['auto_generate_proxy_classes'];
|
||||
}
|
||||
if (isset($config['auto-generate-proxy-classes'])) {
|
||||
$defaultManagerOptions['auto_generate_proxy_classes'] = $config['auto-generate-proxy-classes'];
|
||||
}
|
||||
}
|
||||
$defaultManagerOptions['connection'] = $mergedConfig['default_connection'];
|
||||
|
||||
foreach ($configs as $config) {
|
||||
if (isset($config['entity-managers'])) {
|
||||
$config['entity_managers'] = $config['entity-managers'];
|
||||
}
|
||||
|
||||
$entityManagers = array();
|
||||
if (isset($config['entity_managers'])) {
|
||||
$configEntityManagers = $config['entity_managers'];
|
||||
if (isset($config['entity_managers']['entity-manager'])) {
|
||||
$config['entity_managers']['entity_manager'] = $config['entity_managers']['entity-manager'];
|
||||
}
|
||||
if (isset($config['entity_managers']['entity_manager']) && isset($config['entity_managers']['entity_manager'][0])) {
|
||||
$configEntityManagers = $config['entity_managers']['entity_manager'];
|
||||
}
|
||||
|
||||
foreach ($configEntityManagers as $name => $entityManager) {
|
||||
$name = isset($entityManager['name']) ? $entityManager['name'] : $name;
|
||||
$entityManagers[$name] = $entityManager;
|
||||
}
|
||||
} else {
|
||||
$entityManagers = array($mergedConfig['default_entity_manager'] => $config);
|
||||
}
|
||||
|
||||
foreach ($entityManagers as $name => $managerConfig) {
|
||||
if (!isset($mergedConfig['entity_managers'][$name])) {
|
||||
$mergedConfig['entity_managers'][$name] = $defaultManagerOptions;
|
||||
}
|
||||
|
||||
foreach ($managerConfig as $k => $v) {
|
||||
if (isset($supportedEntityManagerOptions[$k])) {
|
||||
$k = $supportedEntityManagerOptions[$k];
|
||||
$mergedConfig['entity_managers'][$name][$k] = $v;
|
||||
}
|
||||
}
|
||||
$mergedConfig['entity_managers'][$name]['name'] = $name;
|
||||
|
||||
if (isset($managerConfig['mappings'])) {
|
||||
foreach ($managerConfig['mappings'] as $mappingName => $mappingConfig) {
|
||||
if (!isset($mergedConfig['entity_managers'][$name]['mappings'][$mappingName])) {
|
||||
$mergedConfig['entity_managers'][$name]['mappings'][$mappingName] = array();
|
||||
}
|
||||
|
||||
if (is_array($mappingConfig)) {
|
||||
foreach ($mappingConfig as $k => $v) {
|
||||
$mergedConfig['entity_managers'][$name]['mappings'][$mappingName][$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mergedConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a configured ORM entity manager.
|
||||
*
|
||||
* You need to be aware that ormLoad() can be called multiple times, which makes this method tricky to implement.
|
||||
* There are two possible runtime scenarios:
|
||||
*
|
||||
* 1. If the EntityManager was defined before, override only the new calls to Doctrine\ORM\Configuration
|
||||
* 2. If the EntityManager was not defined before, gather all the defaults for not specified options and set all the information.
|
||||
*
|
||||
* @param array $entityManager A configured ORM entity manager.
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
@ -402,7 +165,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
{
|
||||
$configServiceName = sprintf('doctrine.orm.%s_configuration', $entityManager['name']);
|
||||
|
||||
$ormConfigDef = new Definition('Doctrine\ORM\Configuration');
|
||||
$ormConfigDef = new Definition('%doctrine.orm.configuration_class%');
|
||||
$ormConfigDef->setPublic(false);
|
||||
$container->setDefinition($configServiceName, $ormConfigDef);
|
||||
|
||||
@ -414,9 +177,9 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
'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' => $entityManager['proxy_dir'],
|
||||
'setProxyNamespace' => $entityManager['proxy_namespace'],
|
||||
'setAutoGenerateProxyClasses' => $entityManager['auto_generate_proxy_classes'],
|
||||
'setProxyDir' => '%doctrine.orm.proxy_dir%',
|
||||
'setProxyNamespace' => '%doctrine.orm.proxy_namespace%',
|
||||
'setAutoGenerateProxyClasses' => '%doctrine.orm.auto_generate_proxy_classes%',
|
||||
'setClassMetadataFactoryName' => $entityManager['class_metadata_factory_name'],
|
||||
);
|
||||
foreach ($uniqueMethods as $method => $arg) {
|
||||
@ -424,10 +187,11 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
|
||||
$entityManagerService = sprintf('doctrine.orm.%s_entity_manager', $entityManager['name']);
|
||||
$connectionName = isset($entityManager['connection']) ? $entityManager['connection'] : $entityManager['name'];
|
||||
$connectionId = isset($entityManager['connection']) ? sprintf('doctrine.dbal.%s_connection', $entityManager['connection']) : 'database_connection';
|
||||
$eventManagerID = isset($entityManager['connection']) ? sprintf('doctrine.dbal.%s_connection.event_manager', $entityManager['connection']) : 'doctrine.dbal.event_manager';
|
||||
|
||||
$ormEmArgs = array(
|
||||
new Reference(sprintf('doctrine.dbal.%s_connection', $connectionName)),
|
||||
new Reference($connectionId),
|
||||
new Reference(sprintf('doctrine.orm.%s_configuration', $entityManager['name']))
|
||||
);
|
||||
$ormEmDef = new Definition('%doctrine.orm.entity_manager_class%', $ormEmArgs);
|
||||
@ -438,7 +202,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
|
||||
$container->setAlias(
|
||||
sprintf('doctrine.orm.%s_entity_manager.event_manager', $entityManager['name']),
|
||||
new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $connectionName), false)
|
||||
new Alias($eventManagerID, false)
|
||||
);
|
||||
}
|
||||
|
||||
@ -482,7 +246,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
|
||||
$this->loadMappingInformation($entityManager, $container);
|
||||
$this->registerMappingDrivers($entityManager, $container);
|
||||
|
||||
|
||||
$ormConfigDef->addMethodCall('setEntityNamespaces', array($this->aliasMap));
|
||||
}
|
||||
|
||||
@ -534,23 +298,26 @@ class DoctrineExtension extends AbstractDoctrineExtension
|
||||
* Gets an entity manager cache driver definition for metadata, query and result caches.
|
||||
*
|
||||
* @param array $entityManager The array configuring an entity manager.
|
||||
* @param string|array $cacheDriver The cache driver configuration.
|
||||
* @param array $cacheDriver The cache driver configuration.
|
||||
* @param ContainerBuilder $container
|
||||
* @return Definition $cacheDef
|
||||
*/
|
||||
protected function getEntityManagerCacheDefinition(array $entityManager, $cacheDriver, ContainerBuilder $container)
|
||||
{
|
||||
$type = is_array($cacheDriver) && isset($cacheDriver['type']) ? $cacheDriver['type'] : $cacheDriver;
|
||||
if ('memcache' === $type) {
|
||||
$cacheDef = new Definition('%doctrine.orm.cache.memcache_class%');
|
||||
$memcacheInstance = new Definition('%doctrine.orm.cache.memcache_instance_class%');
|
||||
if ('memcache' === $cacheDriver['type']) {
|
||||
$memcacheClass = !empty ($cacheDriver['class']) ? $cacheDriver['class'] : '%doctrine.orm.cache.memcache_class%';
|
||||
$memcacheInstanceClass = !empty ($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%doctrine.orm.cache.memcache_instance_class%';
|
||||
$memcacheHost = !empty ($cacheDriver['host']) ? $cacheDriver['host'] : '%doctrine.orm.cache.memcache_host%';
|
||||
$memcachePort = !empty ($cacheDriver['port']) ? $cacheDriver['port'] : '%doctrine.orm.cache.memcache_port%';
|
||||
$cacheDef = new Definition($memcacheClass);
|
||||
$memcacheInstance = new Definition($memcacheInstanceClass);
|
||||
$memcacheInstance->addMethodCall('connect', array(
|
||||
'%doctrine.orm.cache.memcache_host%', '%doctrine.orm.cache.memcache_port%'
|
||||
$memcacheHost, $memcachePort
|
||||
));
|
||||
$container->setDefinition(sprintf('doctrine.orm.%s_memcache_instance', $entityManager['name']), $memcacheInstance);
|
||||
$cacheDef->addMethodCall('setMemcache', array(new Reference(sprintf('doctrine.orm.%s_memcache_instance', $entityManager['name']))));
|
||||
} else if (in_array($type, array('apc', 'array', 'xcache'))) {
|
||||
$cacheDef = new Definition('%'.sprintf('doctrine.orm.cache.%s_class', $type).'%');
|
||||
} else if (in_array($cacheDriver['type'], array('apc', 'array', 'xcache'))) {
|
||||
$cacheDef = new Definition('%'.sprintf('doctrine.orm.cache.%s_class', $cacheDriver['type']).'%');
|
||||
}
|
||||
$cacheDef->setPublic(false);
|
||||
$cacheDef->addMethodCall('setNamespace', array('sf2orm_'.$entityManager['name']));
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Bundle\DoctrineBundle;
|
||||
|
||||
use Symfony\Bundle\DoctrineBundle\DependencyInjection\Compiler\CreateProxyDirectoryPass;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Bundle\DoctrineBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
@ -33,27 +33,15 @@
|
||||
</xsd:attributeGroup>
|
||||
|
||||
<xsd:complexType name="dbal">
|
||||
<xsd:all>
|
||||
<xsd:element name="connections" type="connections" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="types" type="types" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:all>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="connection" type="connection" />
|
||||
<xsd:element name="type" type="type" />
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="default-connection" type="xsd:string" />
|
||||
<xsd:attributeGroup ref="connection-config" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="connections">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="connection" type="connection" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="types">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="type" type="type" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="type">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="class" type="xsd:string" use="required" />
|
||||
@ -73,18 +61,12 @@
|
||||
<xsd:attribute name="is-bundle" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="mappings">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="mapping" type="mapping" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="orm">
|
||||
<xsd:all>
|
||||
<xsd:element name="entity-managers" type="entity_managers" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="mappings" type="mappings" minOccurs="0" maxOccurs="1" />
|
||||
<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:all>
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="default-entity-manager" type="xsd:string" />
|
||||
<xsd:attribute name="default-connection" type="xsd:string" />
|
||||
@ -106,17 +88,11 @@
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="entity_managers">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="entity-manager" type="entity_manager" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="entity_manager">
|
||||
<xsd:all>
|
||||
<xsd:element name="mappings" type="mappings" minOccurs="0" maxOccurs="1" />
|
||||
<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:all>
|
||||
</xsd:choice>
|
||||
|
||||
<xsd:attribute name="connection" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
{% block menu %}
|
||||
<span class="label">
|
||||
<span class="icon"><img src="{{ asset('bundles/doctrine/images/profiler-menu.png') }}" alt="" /></span>
|
||||
<span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/db.png') }}" alt="" /></span>
|
||||
<strong>Doctrine</strong>
|
||||
<span class="count">
|
||||
<span>{{ collector.querycount }}</span>
|
||||
|
@ -7,6 +7,8 @@ use Symfony\Bundle\DoctrineBundle\Command\InfoDoctrineCommand;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
|
||||
require_once __DIR__.'/../DependencyInjection/Fixtures/Bundles/YamlBundle/Entity/Test.php';
|
||||
|
||||
class InfoDoctrineCommandTest extends TestCase
|
||||
{
|
||||
public function testAnnotationsBundle()
|
||||
|
@ -39,19 +39,14 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
$loader->load(array(array('dbal' => array('password' => 'foo'))), $container);
|
||||
|
||||
$loader->load(array(array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);
|
||||
$loader->load(array(array('dbal' => array('connections' => array('default'=> array('password' => 'foo')))), array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);
|
||||
|
||||
$arguments = $container->getDefinition('doctrine.dbal.default_connection')->getArguments();
|
||||
$config = $arguments[0];
|
||||
|
||||
$this->assertEquals('foo', $config['password']);
|
||||
$this->assertEquals('root', $config['user']);
|
||||
|
||||
$loader->load(array(array('dbal' => array('user' => 'foo'))), $container);
|
||||
$this->assertEquals('foo', $config['password']);
|
||||
$this->assertEquals('root', $config['user']);
|
||||
}
|
||||
|
||||
public function testDbalLoadFromXmlMultipleConnections()
|
||||
@ -117,8 +112,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array('dbal' => array())), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('YamlBundle' => array())))), $container);
|
||||
$loader->load(array(array('dbal' => null, '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'));
|
||||
@ -140,11 +134,16 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$config = array(
|
||||
'proxy_namespace' => 'MyProxies',
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'mappings' => array('YamlBundle' => array()),
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array(
|
||||
'mappings' => array('YamlBundle' => array()),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$loader->load(array(array('dbal' => array())), $container);
|
||||
$loader->load(array('orm' => $config), $container);
|
||||
$container = $this->getContainer();
|
||||
$loader->load(array(array('dbal' => null, 'orm' => $config)), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
$this->assertEquals('Doctrine\DBAL\Connection', $definition->getClass());
|
||||
@ -166,7 +165,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
|
||||
$arguments = $definition->getArguments();
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]);
|
||||
$this->assertEquals('doctrine.dbal.default_connection', (string) $arguments[0]);
|
||||
$this->assertEquals('database_connection', (string) $arguments[0]);
|
||||
$this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.default_configuration', (string) $arguments[1]);
|
||||
|
||||
@ -192,8 +191,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array('dbal' => array())), $container);
|
||||
$loader->load(array(array('orm' => array())), $container);
|
||||
$loader->load(array(array('dbal' => null, 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.default_connection');
|
||||
$this->assertEquals('Doctrine\DBAL\Connection', $definition->getClass());
|
||||
@ -205,7 +203,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$this->assertArrayHasKey('doctrine.orm.entity_manager', $definition->getTags());
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
new Reference('doctrine.dbal.default_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
new Reference('database_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
));
|
||||
}
|
||||
|
||||
@ -215,9 +213,6 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
|
||||
$loader->load(array(array('dbal' => array())), $container);
|
||||
$loader->load(array(array('orm' => array())), $container);
|
||||
|
||||
$this->loadFromFile($container, 'orm_service_simple_single_entity_manager');
|
||||
|
||||
$container->getCompilerPassConfig()->setOptimizationPasses(array());
|
||||
@ -235,6 +230,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
'user' => 'root',
|
||||
'password' => null,
|
||||
'port' => null,
|
||||
'logging' => false,
|
||||
),
|
||||
new Reference('doctrine.dbal.default_connection.configuration'),
|
||||
new Reference('doctrine.dbal.default_connection.event_manager')
|
||||
@ -247,7 +243,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$this->assertArrayHasKey('doctrine.orm.entity_manager', $definition->getTags());
|
||||
|
||||
$this->assertDICConstructorArguments($definition, array(
|
||||
new Reference('doctrine.dbal.default_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
new Reference('database_connection'), new Reference('doctrine.orm.default_configuration')
|
||||
));
|
||||
}
|
||||
|
||||
@ -276,6 +272,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
'password' => 'sqlite_s3cr3t',
|
||||
'dbname' => 'sqlite_db',
|
||||
'memory' => true,
|
||||
'logging' => false,
|
||||
),
|
||||
new Reference('doctrine.dbal.default_connection.configuration'),
|
||||
new Reference('doctrine.dbal.default_connection.event_manager')
|
||||
@ -314,9 +311,9 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$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.dm2_entity_manager', (string) $container->getAlias('doctrine.orm.entity_manager'));
|
||||
$this->assertEquals('doctrine.orm.em2_entity_manager', (string) $container->getAlias('doctrine.orm.entity_manager'));
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm1_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());
|
||||
@ -326,7 +323,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$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.dm1_configuration', (string) $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.em1_configuration', (string) $arguments[1]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.dbal.conn2_connection');
|
||||
$this->assertEquals('Doctrine\DBAL\Connection', $definition->getClass());
|
||||
@ -338,7 +335,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$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.dm2_entity_manager');
|
||||
$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());
|
||||
@ -348,15 +345,15 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$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.dm2_configuration', (string) $arguments[1]);
|
||||
$this->assertEquals('doctrine.orm.em2_configuration', (string) $arguments[1]);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm1_metadata_cache');
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_metadata_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.xcache_class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm1_query_cache');
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_query_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array_class%', $definition->getClass());
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm1_result_cache');
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_result_cache');
|
||||
$this->assertEquals('%doctrine.orm.cache.array_class%', $definition->getClass());
|
||||
}
|
||||
|
||||
@ -365,8 +362,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('YamlBundle' => array())))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setEntityNamespaces',
|
||||
@ -379,8 +375,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('YamlBundle' => array('alias' => 'yml'))))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array('alias' => 'yml'))))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'setEntityNamespaces',
|
||||
@ -393,8 +388,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer('YamlBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('YamlBundle' => array())))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
@ -408,8 +402,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer('XmlBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('XmlBundle' => array())))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('XmlBundle' => array())))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
@ -423,8 +416,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer('AnnotationsBundle');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('AnnotationsBundle' => array())))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array())))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'addDriver', array(
|
||||
@ -438,15 +430,18 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer(array('XmlBundle', 'AnnotationsBundle'));
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array(
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'mappings' => array('AnnotationsBundle' => array())
|
||||
)),
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array('mappings' => array('AnnotationsBundle' => array()))
|
||||
))),
|
||||
array('orm' => array(
|
||||
'auto_generate_proxy_classes' => false,
|
||||
'mappings' => array('XmlBundle' => array())
|
||||
))), $container);
|
||||
'default_entity_manager' => 'default',
|
||||
'entity_managers' => array(
|
||||
'default' => array('mappings' => array('XmlBundle' => array()))
|
||||
)))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_driver');
|
||||
$this->assertDICDefinitionMethodCallAt(0, $definition, 'addDriver', array(
|
||||
@ -459,7 +454,15 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
));
|
||||
|
||||
$configDef = $container->getDefinition('doctrine.orm.default_configuration');
|
||||
$this->assertDICDefinitionMethodCallOnce($configDef, 'setAutoGenerateProxyClasses', array( false ));
|
||||
$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()
|
||||
@ -474,10 +477,10 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
$container->compile();
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm1_metadata_cache');
|
||||
$definition = $container->getDefinition('doctrine.orm.em1_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, '%doctrine.orm.cache.xcache_class%');
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.dm2_metadata_cache');
|
||||
$definition = $container->getDefinition('doctrine.orm.em2_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, '%doctrine.orm.cache.apc_class%');
|
||||
}
|
||||
|
||||
@ -494,15 +497,15 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container->compile();
|
||||
|
||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
||||
$this->assertDICDefinitionClass($definition, '%doctrine.orm.cache.memcache_class%');
|
||||
$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, '%doctrine.orm.cache.memcache_instance_class%');
|
||||
$this->assertDICDefinitionClass($definition, 'Memcache');
|
||||
$this->assertDICDefinitionMethodCallOnce($definition, 'connect', array(
|
||||
'%doctrine.orm.cache.memcache_host%', '%doctrine.orm.cache.memcache_port%'
|
||||
'localhost', '11211'
|
||||
));
|
||||
}
|
||||
|
||||
@ -557,17 +560,17 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$annDef = $container->getDefinition('doctrine.orm.default_annotation_metadata_driver');
|
||||
$this->assertDICConstructorArguments($annDef, array(
|
||||
new Reference('doctrine.orm.metadata.annotation_reader'),
|
||||
array(__DIR__ . '/Fixtures/Bundles/AnnotationsBundle/Entity')
|
||||
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__ . '/Fixtures/Bundles/YamlBundle/Resources/config/doctrine/metadata')
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine'.DIRECTORY_SEPARATOR.'metadata')
|
||||
));
|
||||
|
||||
$xmlDef = $container->getDefinition('doctrine.orm.default_xml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($xmlDef, array(
|
||||
array(__DIR__ . '/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata')
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine'.DIRECTORY_SEPARATOR.'metadata')
|
||||
));
|
||||
}
|
||||
|
||||
@ -606,17 +609,17 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$annDef = $container->getDefinition('doctrine.orm.em1_annotation_metadata_driver');
|
||||
$this->assertDICConstructorArguments($annDef, array(
|
||||
new Reference('doctrine.orm.metadata.annotation_reader'),
|
||||
array(__DIR__ . '/Fixtures/Bundles/AnnotationsBundle/Entity')
|
||||
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__ . '/Fixtures/Bundles/YamlBundle/Resources/config/doctrine/metadata')
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'YamlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine'.DIRECTORY_SEPARATOR.'metadata')
|
||||
));
|
||||
|
||||
$xmlDef = $container->getDefinition('doctrine.orm.em2_xml_metadata_driver');
|
||||
$this->assertDICConstructorArguments($xmlDef, array(
|
||||
array(__DIR__ . '/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata')
|
||||
array(__DIR__ .DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'Bundles'.DIRECTORY_SEPARATOR.'XmlBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'doctrine'.DIRECTORY_SEPARATOR.'metadata')
|
||||
));
|
||||
}
|
||||
|
||||
@ -625,8 +628,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
$container = $this->getContainer('AnnotationsBundle', 'Vendor');
|
||||
$loader = new DoctrineExtension();
|
||||
|
||||
$loader->load(array(array()), $container);
|
||||
$loader->load(array(array('orm' => array('mappings' => array('AnnotationsBundle' => array())))), $container);
|
||||
$loader->load(array(array('orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array())))))), $container);
|
||||
|
||||
$calls = $container->getDefinition('doctrine.orm.default_metadata_driver')->getMethodCalls();
|
||||
$this->assertEquals('doctrine.orm.default_annotation_metadata_driver', (string) $calls[0][1][0]);
|
||||
@ -664,6 +666,7 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||
}
|
||||
|
||||
return new ContainerBuilder(new ParameterBag(array(
|
||||
'kernel.debug' => false,
|
||||
'kernel.bundles' => $map,
|
||||
'kernel.cache_dir' => sys_get_temp_dir(),
|
||||
'kernel.root_dir' => __DIR__ . "/../../../../../" // src dir
|
||||
|
@ -7,29 +7,27 @@
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal>
|
||||
<connections>
|
||||
<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" />
|
||||
</connections>
|
||||
<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>
|
||||
|
@ -7,15 +7,13 @@
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal>
|
||||
<connections>
|
||||
<connection
|
||||
name="mysql"
|
||||
dbname="mysql_db"
|
||||
user="mysql_user"
|
||||
password="mysql_s3cr3t"
|
||||
unix-socket="/path/to/mysqld.sock" /><!-- -->
|
||||
</connections>
|
||||
<dbal default-connection="mysql">
|
||||
<connection
|
||||
name="mysql"
|
||||
dbname="mysql_db"
|
||||
user="mysql_user"
|
||||
password="mysql_s3cr3t"
|
||||
unix-socket="/path/to/mysqld.sock" /><!-- -->
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
||||
|
@ -7,10 +7,9 @@
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<dbal>
|
||||
<types>
|
||||
<type name="test" class="Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType" />
|
||||
</types>
|
||||
<dbal default-connection="default">
|
||||
<type name="test" class="Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType" />
|
||||
<connection name="default" />
|
||||
</dbal>
|
||||
</config>
|
||||
</srv:container>
|
||||
|
@ -9,7 +9,11 @@
|
||||
<config>
|
||||
<orm
|
||||
auto-generate-proxy-classes="false"
|
||||
metadata-cache-driver="apc"
|
||||
/>
|
||||
default-entity-manager="default"
|
||||
>
|
||||
<entity-manager name="default" metadata-cache-driver="apc">
|
||||
<mapping name="YamlBundle" />
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
||||
|
@ -7,23 +7,17 @@
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<orm>
|
||||
<entity-managers>
|
||||
<entity-manager name="em1">
|
||||
<mappings>
|
||||
<mapping name="AnnotationsBundle" />
|
||||
</mappings>
|
||||
</entity-manager>
|
||||
<entity-manager name="em2">
|
||||
<mappings>
|
||||
<mapping name="YamlBundle" dir="Resources/config/doctrine/metadata" alias="yml" />
|
||||
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
|
||||
dir="%kernel.root_dir%/../src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata"
|
||||
alias="TestAlias"
|
||||
/>
|
||||
</mappings>
|
||||
</entity-manager>
|
||||
</entity-managers>
|
||||
<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/metadata" alias="yml" />
|
||||
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
|
||||
dir="%kernel.root_dir%/../src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata"
|
||||
alias="TestAlias"
|
||||
/>
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
||||
|
@ -11,30 +11,30 @@
|
||||
</srv:parameters>
|
||||
|
||||
<config>
|
||||
<dbal>
|
||||
<connections>
|
||||
<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" />
|
||||
</connections>
|
||||
<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="dm2" default-connection="conn1" auto-generate-proxy-classes="true">
|
||||
<entity-managers>
|
||||
<entity-manager name="dm1" metadata-cache-driver="xcache" connection="conn1" />
|
||||
<entity-manager name="dm2" connection="conn2" metadata-cache-driver="apc" />
|
||||
</entity-managers>
|
||||
<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>
|
||||
|
@ -8,13 +8,16 @@
|
||||
|
||||
<config>
|
||||
<dbal />
|
||||
<orm>
|
||||
<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>
|
||||
<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>
|
||||
|
@ -11,34 +11,29 @@
|
||||
</srv:parameters>
|
||||
|
||||
<config>
|
||||
<dbal>
|
||||
<connections>
|
||||
<connection
|
||||
name="default"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
</connections>
|
||||
<dbal default-connection="default">
|
||||
<connection
|
||||
name="default"
|
||||
driver="pdo_sqlite"
|
||||
dbname="sqlite_db"
|
||||
user="sqlite_user"
|
||||
password="sqlite_s3cr3t"
|
||||
memory="true" />
|
||||
</dbal>
|
||||
|
||||
<orm
|
||||
metadata-cache-driver="apc"
|
||||
default-entity-manager="dm2"
|
||||
default-connection="conn1"
|
||||
default-entity-manager="default"
|
||||
auto-generate-proxy-classes="true"
|
||||
>
|
||||
<entity-managers>
|
||||
<entity-manager name="default" connection="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>
|
||||
</entity-manager>
|
||||
</entity-managers>
|
||||
<entity-manager name="default" connection="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>
|
||||
|
@ -7,15 +7,15 @@
|
||||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
|
||||
|
||||
<config>
|
||||
<orm>
|
||||
<mappings>
|
||||
<orm default-entity-manager="default">
|
||||
<entity-manager name="default">
|
||||
<mapping name="AnnotationsBundle" />
|
||||
<mapping name="YamlBundle" dir="Resources/config/doctrine/metadata" alias="yml" />
|
||||
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
|
||||
dir="%kernel.root_dir%/../src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata"
|
||||
alias="TestAlias"
|
||||
/>
|
||||
</mappings>
|
||||
</entity-manager>
|
||||
</orm>
|
||||
</config>
|
||||
</srv:container>
|
||||
|
@ -1,5 +1,6 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: mysql
|
||||
connections:
|
||||
mysql:
|
||||
dbname: mysql_db
|
||||
|
@ -1,5 +1,6 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: mysql
|
||||
connections:
|
||||
mysql:
|
||||
dbname: mysql_db
|
||||
|
@ -1,4 +1,7 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
types:
|
||||
test: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType
|
||||
test: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType
|
||||
connections:
|
||||
default: ~
|
||||
|
@ -1,4 +1,9 @@
|
||||
doctrine:
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
metadata_cache_driver: apc
|
||||
default_entity_manager: default
|
||||
entity_managers:
|
||||
default:
|
||||
metadata_cache_driver: apc
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
|
@ -1,5 +1,6 @@
|
||||
doctrine:
|
||||
orm:
|
||||
default_entity_manager: em2
|
||||
entity_managers:
|
||||
em1:
|
||||
mappings:
|
||||
|
@ -3,6 +3,7 @@ parameters:
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: conn1
|
||||
connections:
|
||||
conn1:
|
||||
driver: pdo_sqlite
|
||||
@ -18,13 +19,16 @@ doctrine:
|
||||
memory: true
|
||||
|
||||
orm:
|
||||
default_entity_manager: dm2
|
||||
default_connection: conn1
|
||||
default_entity_manager: em2
|
||||
auto_generate_proxy_classes: true
|
||||
entity_managers:
|
||||
dm1:
|
||||
em1:
|
||||
metadata_cache_driver: xcache
|
||||
connection: conn1
|
||||
dm2:
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
em2:
|
||||
metadata_cache_driver: apc
|
||||
connection: conn2
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
|
@ -1,10 +1,14 @@
|
||||
doctrine:
|
||||
dbal: ~
|
||||
|
||||
orm:
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
||||
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
|
||||
|
@ -1,5 +1,6 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
driver: pdo_sqlite
|
||||
@ -9,14 +10,14 @@ doctrine:
|
||||
memory: true
|
||||
|
||||
orm:
|
||||
metadata_cache_driver: apc
|
||||
default_entity_manager: dm2
|
||||
default_connection: conn1
|
||||
proxy_namespace: Proxies
|
||||
auto_generate_proxy_classes: true
|
||||
entity_managers:
|
||||
default:
|
||||
connection: default
|
||||
mappings:
|
||||
YamlBundle: ~
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
|
@ -1,12 +1,15 @@
|
||||
doctrine:
|
||||
orm:
|
||||
mappings:
|
||||
AnnotationsBundle: ~
|
||||
YamlBundle:
|
||||
dir: Resources/config/doctrine/metadata
|
||||
alias: yml
|
||||
manual:
|
||||
type: xml
|
||||
prefix: Fixtures\Bundles\XmlBundle
|
||||
dir: %kernel.root_dir%/../src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata
|
||||
alias: TestAlias
|
||||
default_entity_manager: default
|
||||
entity_managers:
|
||||
default:
|
||||
mappings:
|
||||
AnnotationsBundle: ~
|
||||
YamlBundle:
|
||||
dir: Resources/config/doctrine/metadata
|
||||
alias: yml
|
||||
manual:
|
||||
type: xml
|
||||
prefix: Fixtures\Bundles\XmlBundle
|
||||
dir: %kernel.root_dir%/../src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine/metadata
|
||||
alias: TestAlias
|
||||
|
@ -50,31 +50,38 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
||||
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.root_dir' => __DIR__ . "/../../../../" // src dir
|
||||
)));
|
||||
$loader = new DoctrineExtension();
|
||||
$container->registerExtension($loader);
|
||||
$loader->load(array(array('dbal' => array(
|
||||
'connections' => array(
|
||||
'default' => array(
|
||||
'driver' => 'pdo_mysql',
|
||||
'charset' => 'UTF-8',
|
||||
'platform-service' => 'my.platform',
|
||||
$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/metadata/orm",
|
||||
'prefix' => 'Fixtures\Bundles\YamlBundle',
|
||||
)
|
||||
)
|
||||
),
|
||||
'types' => array(
|
||||
'test' => 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestType',
|
||||
),
|
||||
))), $container);
|
||||
$loader->load(array(
|
||||
array('orm' => array(
|
||||
'mappings' => array('YamlBundle' => array(
|
||||
'type' => 'yml',
|
||||
'dir' => __DIR__ . "/DependencyInjection/Fixtures/Bundles/YamlBundle/Resources/config/doctrine/metadata/orm",
|
||||
'prefix' => 'Fixtures\Bundles\YamlBundle',
|
||||
))))), $container);
|
||||
)))
|
||||
)), $container);
|
||||
|
||||
$container->setDefinition('my.platform', new \Symfony\Component\DependencyInjection\Definition('Doctrine\DBAL\Platforms\MySqlPlatform'));
|
||||
|
||||
|
@ -37,10 +37,10 @@ class MigrationsDiffDoctrineCommand extends DiffCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class MigrationsExecuteDoctrineCommand extends ExecuteCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class MigrationsGenerateDoctrineCommand extends GenerateCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class MigrationsMigrateDoctrineCommand extends MigrateCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class MigrationsStatusDoctrineCommand extends StatusCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ class MigrationsVersionDoctrineCommand extends VersionCommand
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
|
||||
DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
|
||||
|
||||
$configuration = $this->getMigrationConfiguration($input, $output);
|
||||
DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
|
||||
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ abstract class DoctrineODMCommand extends Command
|
||||
protected function findBundle($bundleName)
|
||||
{
|
||||
$foundBundle = false;
|
||||
foreach ($this->application->getKernel()->getBundles() as $bundle) {
|
||||
foreach ($this->getApplication()->getKernel()->getBundles() as $bundle) {
|
||||
/* @var $bundle Bundle */
|
||||
if (strtolower($bundleName) == strtolower($bundle->getName())) {
|
||||
$foundBundle = $bundle;
|
||||
|
@ -46,7 +46,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
|
||||
|
||||
parent::execute($input, $output);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ EOT
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class QueryDoctrineODMCommand extends QueryCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
|
||||
DoctrineODMCommand::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
|
||||
|
||||
return parent::execute($input, $output);
|
||||
}
|
||||
|
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
|
||||
/**
|
||||
* FrameworkExtension configuration structure.
|
||||
*
|
||||
* @author Ryan Weaver <ryan@thatsquality.com>
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Boolean $debug The kernel.debug value
|
||||
*/
|
||||
public function __construct($debug)
|
||||
{
|
||||
$this->debug = (Boolean) $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
|
||||
*/
|
||||
public function getConfigTree()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('doctrine_mongo_db', 'array');
|
||||
|
||||
$this->addDocumentManagersSection($rootNode);
|
||||
$this->addConnectionsSection($rootNode);
|
||||
|
||||
$rootNode
|
||||
->scalarNode('proxy_namespace')->defaultValue('Proxies')->end()
|
||||
->scalarNode('auto_generate_proxy_classes')->defaultValue(false)->end()
|
||||
->scalarNode('hydrator_namespace')->defaultValue('Hydrators')->end()
|
||||
->scalarNode('auto_generate_hydrator_classes')->defaultValue(false)->end()
|
||||
->scalarNode('default_document_manager')->defaultValue('default')->end()
|
||||
->scalarNode('default_connection')->defaultValue('default')->end()
|
||||
->scalarNode('default_database')->defaultValue('default')->end()
|
||||
;
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the "document_managers" section
|
||||
*/
|
||||
private function addDocumentManagersSection(NodeBuilder $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
->fixXmlConfig('document_manager')
|
||||
->arrayNode('document_managers')
|
||||
->useAttributeAsKey('id')
|
||||
->prototype('array')
|
||||
//->performNoDeepMerging()
|
||||
->treatNullLike(array())
|
||||
->builder($this->getMetadataCacheDriverNode())
|
||||
->scalarNode('connection')->end()
|
||||
->scalarNode('database')->end()
|
||||
->booleanNode('logging')->defaultValue($this->debug)->end()
|
||||
->fixXmlConfig('mapping')
|
||||
->builder($this->getMappingsNode())
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the configuration for the "connections" key
|
||||
*/
|
||||
private function addConnectionsSection(NodeBuilder $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
->fixXmlConfig('connection')
|
||||
->arrayNode('connections')
|
||||
->useAttributeAsKey('id')
|
||||
->prototype('array')
|
||||
->performNoDeepMerging()
|
||||
->scalarNode('server')->defaultNull()->end()
|
||||
->builder($this->addConnectionOptionsNode())
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array node used for "mappings".
|
||||
*
|
||||
* This is used in two different parts of the tree.
|
||||
*
|
||||
* @param NodeBuilder $rootNode The parent node
|
||||
* @return NodeBuilder
|
||||
*/
|
||||
protected function getMappingsNode()
|
||||
{
|
||||
$node = new Nodebuilder('mappings', 'array');
|
||||
$node
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->beforeNormalization()
|
||||
// if it's not an array, then the scalar is the type key
|
||||
->ifString()
|
||||
->then(function($v) { return array ('type' => $v); })
|
||||
->end()
|
||||
// I believe that "null" should *not* set the type
|
||||
// it's guessed in AbstractDoctrineExtension::detectMetadataDriver
|
||||
->treatNullLike(array())
|
||||
->scalarNode('type')->end()
|
||||
->scalarNode('dir')->end()
|
||||
->scalarNode('prefix')->end()
|
||||
->scalarNode('alias')->end()
|
||||
->booleanNode('is_bundle')->end()
|
||||
->performNoDeepMerging()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the NodeBuilder for the "options" key of a connection.
|
||||
*/
|
||||
private function addConnectionOptionsNode()
|
||||
{
|
||||
$node = new NodeBuilder('options', 'array');
|
||||
|
||||
$node
|
||||
->performNoDeepMerging()
|
||||
->addDefaultsIfNotSet() // adds an empty array of omitted
|
||||
|
||||
// options go into the Mongo constructor
|
||||
// http://www.php.net/manual/en/mongo.construct.php
|
||||
->booleanNode('connect')->end()
|
||||
->scalarNode('persist')->end()
|
||||
->scalarNode('timeout')->end()
|
||||
->booleanNode('replicaSet')->end()
|
||||
->scalarNode('username')->end()
|
||||
->scalarNode('password')->end()
|
||||
->end();
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function getMetadataCacheDriverNode()
|
||||
{
|
||||
$node = new NodeBuilder('metadata_cache_driver', 'array');
|
||||
|
||||
$node
|
||||
->beforeNormalization()
|
||||
// if scalar
|
||||
->ifTrue(function($v) { return !is_array($v); })
|
||||
->then(function($v) { return array('type' => $v); })
|
||||
->end()
|
||||
->scalarNode('type')->end()
|
||||
->scalarNode('class')->end()
|
||||
->scalarNode('host')->end()
|
||||
->scalarNode('port')->end()
|
||||
->scalarNode('instance_class')->end()
|
||||
->end();
|
||||
|
||||
return $node;
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
/**
|
||||
* Doctrine MongoDB ODM extension.
|
||||
@ -30,96 +31,105 @@ use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineEx
|
||||
*/
|
||||
class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
{
|
||||
/**
|
||||
* Responds to the doctrine_mongo_db configuration parameter.
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
foreach ($configs as $config) {
|
||||
$this->doMongodbLoad($config, $container);
|
||||
// Load DoctrineMongoDBBundle/Resources/config/mongodb.xml
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('mongodb.xml');
|
||||
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration($container->getParameter('kernel.debug'));
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
// can't currently default this correctly in Configuration
|
||||
if (!isset($config['metadata_cache_driver'])) {
|
||||
$config['metadata_cache_driver'] = array('type' => 'array');
|
||||
}
|
||||
|
||||
// set some options as parameters and unset them
|
||||
$config = $this->overrideParameters($config, $container);
|
||||
|
||||
// load the connections
|
||||
$this->loadConnections($config['connections'], $container);
|
||||
|
||||
// load the document managers
|
||||
$this->loadDocumentManagers(
|
||||
$config['document_managers'],
|
||||
$config['default_document_manager'],
|
||||
$config['default_database'],
|
||||
$config['metadata_cache_driver'],
|
||||
$container
|
||||
);
|
||||
|
||||
$this->loadConstraints($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the MongoDB ODM configuration.
|
||||
* Uses some of the extension options to override DI extension parameters.
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
* <doctrine:mongodb server="mongodb://localhost:27017" />
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param array $options The available configuration options
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function doMongodbLoad($config, ContainerBuilder $container)
|
||||
protected function overrideParameters($options, ContainerBuilder $container)
|
||||
{
|
||||
$this->loadDefaults($config, $container);
|
||||
$this->loadConnections($config, $container);
|
||||
$this->loadDocumentManagers($config, $container);
|
||||
$this->loadConstraints($config, $container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the default configuration.
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadDefaults(array $config, ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('doctrine.odm.mongodb.metadata.annotation')) {
|
||||
// Load DoctrineMongoDBBundle/Resources/config/mongodb.xml
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('mongodb.xml');
|
||||
}
|
||||
|
||||
// Allow these application configuration options to override the defaults
|
||||
$options = array(
|
||||
'default_document_manager',
|
||||
'default_connection',
|
||||
'metadata_cache_driver',
|
||||
$overrides = array(
|
||||
'proxy_namespace',
|
||||
'auto_generate_proxy_classes',
|
||||
'hydrator_namespace',
|
||||
'auto_generate_hydrator_classes',
|
||||
'default_database',
|
||||
);
|
||||
foreach ($options as $key) {
|
||||
if (isset($config[$key])) {
|
||||
$container->setParameter('doctrine.odm.mongodb.'.$key, $config[$key]);
|
||||
}
|
||||
|
||||
$nKey = str_replace('_', '-', $key);
|
||||
if (isset($config[$nKey])) {
|
||||
$container->setParameter('doctrine.odm.mongodb.'.$key, $config[$nKey]);
|
||||
foreach ($overrides as $key) {
|
||||
if (isset($options[$key])) {
|
||||
$container->setParameter('doctrine.odm.mongodb.'.$key, $options[$key]);
|
||||
|
||||
// the option should not be used, the parameter should be referenced
|
||||
unset($options[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the document managers configuration.
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param array $dmConfigs An array of document manager configs
|
||||
* @param string $defaultDM The default document manager name
|
||||
* @param string $defaultDB The default db name
|
||||
* @param string $defaultMetadataCache The default metadata cache configuration
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadDocumentManagers(array $config, ContainerBuilder $container)
|
||||
protected function loadDocumentManagers(array $dmConfigs, $defaultDM, $defaultDB, $defaultMetadataCache, ContainerBuilder $container)
|
||||
{
|
||||
$documentManagers = $this->getDocumentManagers($config, $container);
|
||||
foreach ($documentManagers as $name => $documentManager) {
|
||||
foreach ($dmConfigs as $name => $documentManager) {
|
||||
$documentManager['name'] = $name;
|
||||
$this->loadDocumentManager($documentManager, $container);
|
||||
$this->loadDocumentManager(
|
||||
$documentManager,
|
||||
$defaultDM,
|
||||
$defaultDB,
|
||||
$defaultMetadataCache,
|
||||
$container
|
||||
);
|
||||
}
|
||||
$container->setParameter('doctrine.odm.mongodb.document_managers', array_keys($documentManagers));
|
||||
$container->setParameter('doctrine.odm.mongodb.document_managers', array_keys($dmConfigs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a document manager configuration.
|
||||
*
|
||||
* @param array $documentManager A document manager configuration array
|
||||
* @param string $defaultDM The default document manager name
|
||||
* @param string $defaultDB The default db name
|
||||
* @param string $defaultMetadataCache The default metadata cache configuration
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadDocumentManager(array $documentManager, ContainerBuilder $container)
|
||||
protected function loadDocumentManager(array $documentManager, $defaultDM, $defaultDB, $defaultMetadataCache, ContainerBuilder $container)
|
||||
{
|
||||
$defaultDocumentManager = $container->getParameter('doctrine.odm.mongodb.default_document_manager');
|
||||
$defaultDatabase = isset($documentManager['default_database']) ? $documentManager['default_database'] : $container->getParameter('doctrine.odm.mongodb.default_database');
|
||||
$proxyCacheDir = $container->getParameter('kernel.cache_dir').'/doctrine/odm/mongodb/Proxies';
|
||||
$hydratorCacheDir = $container->getParameter('kernel.cache_dir').'/doctrine/odm/mongodb/Hydrators';
|
||||
$defaultDatabase = isset($documentManager['default_database']) ? $documentManager['default_database'] : $defaultDB;
|
||||
$configServiceName = sprintf('doctrine.odm.mongodb.%s_configuration', $documentManager['name']);
|
||||
|
||||
if ($container->hasDefinition($configServiceName)) {
|
||||
@ -130,20 +140,24 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
|
||||
$this->loadDocumentManagerBundlesMappingInformation($documentManager, $odmConfigDef, $container);
|
||||
$this->loadDocumentManagerMetadataCacheDriver($documentManager, $container);
|
||||
$this->loadDocumentManagerMetadataCacheDriver($documentManager, $container, $defaultMetadataCache);
|
||||
|
||||
$methods = array(
|
||||
'setMetadataCacheImpl' => new Reference(sprintf('doctrine.odm.mongodb.%s_metadata_cache', $documentManager['name'])),
|
||||
'setMetadataDriverImpl' => new Reference(sprintf('doctrine.odm.mongodb.%s_metadata_driver', $documentManager['name'])),
|
||||
'setProxyDir' => $proxyCacheDir,
|
||||
'setProxyNamespace' => $container->getParameter('doctrine.odm.mongodb.proxy_namespace'),
|
||||
'setAutoGenerateProxyClasses' => $container->getParameter('doctrine.odm.mongodb.auto_generate_proxy_classes'),
|
||||
'setHydratorDir' => $hydratorCacheDir,
|
||||
'setHydratorNamespace' => $container->getParameter('doctrine.odm.mongodb.hydrator_namespace'),
|
||||
'setAutoGenerateHydratorClasses' => $container->getParameter('doctrine.odm.mongodb.auto_generate_hydrator_classes'),
|
||||
'setProxyDir' => '%kernel.cache_dir%'.'/doctrine/odm/mongodb/Proxies',
|
||||
'setProxyNamespace' => '%doctrine.odm.mongodb.proxy_namespace%',
|
||||
'setAutoGenerateProxyClasses' => '%doctrine.odm.mongodb.auto_generate_proxy_classes%',
|
||||
'setHydratorDir' => '%kernel.cache_dir%'.'/doctrine/odm/mongodb/Hydrators',
|
||||
'setHydratorNamespace' => '%doctrine.odm.mongodb.hydrator_namespace%',
|
||||
'setAutoGenerateHydratorClasses' => '%doctrine.odm.mongodb.auto_generate_hydrator_classes%',
|
||||
'setDefaultDB' => $defaultDatabase,
|
||||
'setLoggerCallable' => array(new Reference('doctrine.odm.mongodb.logger'), 'logQuery'),
|
||||
);
|
||||
|
||||
if ($documentManager['logging']) {
|
||||
$methods['setLoggerCallable'] = array(new Reference('doctrine.odm.mongodb.logger'), 'logQuery');
|
||||
}
|
||||
|
||||
foreach ($methods as $method => $arg) {
|
||||
if ($odmConfigDef->hasMethodCall($method)) {
|
||||
$odmConfigDef->removeMethodCall($method);
|
||||
@ -172,7 +186,7 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
$odmDmDef->addTag('doctrine.odm.mongodb.document_manager');
|
||||
$container->setDefinition(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManager['name']), $odmDmDef);
|
||||
|
||||
if ($documentManager['name'] == $defaultDocumentManager) {
|
||||
if ($documentManager['name'] == $defaultDM) {
|
||||
$container->setAlias(
|
||||
'doctrine.odm.mongodb.document_manager',
|
||||
new Alias(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManager['name']))
|
||||
@ -184,53 +198,17 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configured document managers.
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function getDocumentManagers(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$defaultDocumentManager = $container->getParameter('doctrine.odm.mongodb.default_document_manager');
|
||||
|
||||
$documentManagers = array();
|
||||
|
||||
if (isset($config['document-managers'])) {
|
||||
$config['document_managers'] = $config['document-managers'];
|
||||
}
|
||||
|
||||
if (isset($config['document_managers'])) {
|
||||
$configDocumentManagers = $config['document_managers'];
|
||||
|
||||
if (isset($config['document_managers']['document-manager'])) {
|
||||
$config['document_managers']['document_manager'] = $config['document_managers']['document-manager'];
|
||||
}
|
||||
|
||||
if (isset($config['document_managers']['document_manager']) && isset($config['document_managers']['document_manager'][0])) {
|
||||
// Multiple document managers
|
||||
$configDocumentManagers = $config['document_managers']['document_manager'];
|
||||
}
|
||||
foreach ($configDocumentManagers as $name => $documentManager) {
|
||||
$documentManagers[isset($documentManager['id']) ? $documentManager['id'] : $name] = $documentManager;
|
||||
}
|
||||
} else {
|
||||
$documentManagers = array($defaultDocumentManager => $config);
|
||||
}
|
||||
return $documentManagers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the configured document manager metadata cache driver.
|
||||
*
|
||||
* @param array $config A configured document manager array
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param array $config A configured document manager array
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param array $defaultMetadataCache The default metadata cache configuration array
|
||||
*/
|
||||
protected function loadDocumentManagerMetadataCacheDriver(array $documentManager, ContainerBuilder $container)
|
||||
protected function loadDocumentManagerMetadataCacheDriver(array $documentManager, ContainerBuilder $container, $defaultMetadataCache)
|
||||
{
|
||||
$metadataCacheDriver = $container->getParameter('doctrine.odm.mongodb.metadata_cache_driver');
|
||||
$dmMetadataCacheDriver = isset($documentManager['metadata-cache-driver']) ? $documentManager['metadata-cache-driver'] : (isset($documentManager['metadata_cache_driver']) ? $documentManager['metadata_cache_driver'] : $metadataCacheDriver);
|
||||
$type = is_array($dmMetadataCacheDriver) && isset($dmMetadataCacheDriver['type']) ? $dmMetadataCacheDriver['type'] : $dmMetadataCacheDriver;
|
||||
$dmMetadataCacheDriver = isset($documentManager['metadata_cache_driver']) ? $documentManager['metadata_cache_driver'] : $defaultMetadataCache;
|
||||
$type = $dmMetadataCacheDriver['type'];
|
||||
|
||||
if ('memcache' === $type) {
|
||||
$memcacheClass = isset($dmMetadataCacheDriver['class']) ? $dmMetadataCacheDriver['class'] : sprintf('%%doctrine.odm.mongodb.cache.%s_class%%', $type);
|
||||
@ -245,18 +223,18 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
} else {
|
||||
$cacheDef = new Definition(sprintf('%%doctrine.odm.mongodb.cache.%s_class%%', $type));
|
||||
}
|
||||
|
||||
$container->setDefinition(sprintf('doctrine.odm.mongodb.%s_metadata_cache', $documentManager['name']), $cacheDef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the configured connections.
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param array $config An array of connections configurations
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function loadConnections(array $config, ContainerBuilder $container)
|
||||
protected function loadConnections(array $connections, ContainerBuilder $container)
|
||||
{
|
||||
$connections = $this->getConnections($config, $container);
|
||||
foreach ($connections as $name => $connection) {
|
||||
$odmConnArgs = array(
|
||||
isset($connection['server']) ? $connection['server'] : null,
|
||||
@ -268,32 +246,6 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the configured connections.
|
||||
*
|
||||
* @param array $config An array of configuration settings
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
protected function getConnections(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$defaultConnection = $container->getParameter('doctrine.odm.mongodb.default_connection');
|
||||
|
||||
$connections = array();
|
||||
if (isset($config['connections'])) {
|
||||
$configConnections = $config['connections'];
|
||||
if (isset($config['connections']['connection']) && isset($config['connections']['connection'][0])) {
|
||||
// Multiple connections
|
||||
$configConnections = $config['connections']['connection'];
|
||||
}
|
||||
foreach ($configConnections as $name => $connection) {
|
||||
$connections[isset($connection['id']) ? $connection['id'] : $name] = $connection;
|
||||
}
|
||||
} else {
|
||||
$connections = array($defaultConnection => $config);
|
||||
}
|
||||
return $connections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an ODM document managers bundle mapping information.
|
||||
*
|
||||
@ -349,7 +301,7 @@ class DoctrineMongoDBExtension extends AbstractDoctrineExtension
|
||||
$odmConfigDef->addMethodCall('setDocumentNamespaces', array($this->aliasMap));
|
||||
}
|
||||
|
||||
protected function loadConstraints($config, ContainerBuilder $container)
|
||||
protected function loadConstraints(ContainerBuilder $container)
|
||||
{
|
||||
if ($container->hasParameter('validator.annotations.namespaces')) {
|
||||
$container->setParameter('validator.annotations.namespaces', array_merge(
|
||||
|
@ -12,72 +12,233 @@
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\Logger;
|
||||
|
||||
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Logger for the Doctrine MongoDB ODM.
|
||||
*
|
||||
* The {@link logQuery()} method is configured as the logger callable in the
|
||||
* service container.
|
||||
*
|
||||
* @author Kris Wallsmith <kris.wallsmith@symfony.com>
|
||||
*/
|
||||
class DoctrineMongoDBLogger
|
||||
{
|
||||
const LOG_PREFIX = 'MongoDB query: ';
|
||||
|
||||
protected $logger;
|
||||
protected $nbQueries;
|
||||
|
||||
public function __construct(LoggerInterface $logger = null)
|
||||
protected $prefix;
|
||||
protected $queries;
|
||||
|
||||
protected $processed;
|
||||
protected $formattedQueries;
|
||||
protected $nbRealQueries;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param LoggerInterface $logger The Symfony logger
|
||||
* @param string $prefix A prefix for messages sent to the Symfony logger
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger = null, $prefix = 'MongoDB query: ')
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->nbQueries = 0;
|
||||
}
|
||||
|
||||
public function logQuery($query)
|
||||
{
|
||||
++$this->nbQueries;
|
||||
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->info(static::LOG_PREFIX.static::formatQuery($query));
|
||||
}
|
||||
}
|
||||
|
||||
public function getNbQueries()
|
||||
{
|
||||
return $this->nbQueries;
|
||||
}
|
||||
|
||||
public function getQueries()
|
||||
{
|
||||
if (null === $this->logger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$logger = $this->logger->getDebugLogger();
|
||||
|
||||
if (!$logger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$offset = strlen(static::LOG_PREFIX);
|
||||
$mapper = function($log) use($offset)
|
||||
{
|
||||
if (0 === strpos($log['message'], DoctrineMongoDBLogger::LOG_PREFIX)) {
|
||||
return substr($log['message'], $offset);
|
||||
}
|
||||
};
|
||||
|
||||
// map queries from logs, remove empty entries and re-index the array
|
||||
return array_values(array_filter(array_map($mapper, $logger->getLogs())));
|
||||
$this->prefix = $prefix;
|
||||
$this->queries = array();
|
||||
$this->processed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the supplied query array recursively.
|
||||
* Logs a query.
|
||||
*
|
||||
* @param array $query All or part of a query array
|
||||
* This method is configured as the logger callable in the service
|
||||
* container.
|
||||
*
|
||||
* @return string A serialized object for the log
|
||||
* @param array $query A query log array from Doctrine
|
||||
*/
|
||||
static protected function formatQuery(array $query, $array = true)
|
||||
public function logQuery(array $query)
|
||||
{
|
||||
$this->queries[] = $query;
|
||||
$this->processed = false;
|
||||
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->info($this->prefix.static::bsonEncode($query));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of queries that have been logged.
|
||||
*
|
||||
* @return integer The number of queries logged
|
||||
*/
|
||||
public function getNbQueries()
|
||||
{
|
||||
if (!$this->processed) {
|
||||
$this->processQueries();
|
||||
}
|
||||
|
||||
return $this->nbRealQueries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a human-readable array of queries logged.
|
||||
*
|
||||
* @return array An array of queries
|
||||
*/
|
||||
public function getQueries()
|
||||
{
|
||||
if (!$this->processed) {
|
||||
$this->processQueries();
|
||||
}
|
||||
|
||||
return $this->formattedQueries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups and formats query arrays.
|
||||
*
|
||||
* @param array $queries An array of query arrays
|
||||
*
|
||||
* @return array An array of human-readable queries
|
||||
*/
|
||||
protected function processQueries()
|
||||
{
|
||||
$this->formattedQueries = array();
|
||||
$this->nbRealQueries = 0;
|
||||
|
||||
$grouped = array();
|
||||
$ordered = array();
|
||||
foreach ($this->queries as $query) {
|
||||
if (!isset($query['query']) || !isset($query['fields'])) {
|
||||
// no grouping necessary
|
||||
$ordered[] = array($query);
|
||||
continue;
|
||||
}
|
||||
|
||||
$cursor = serialize($query['query']).serialize($query['fields']);
|
||||
|
||||
// append if issued from cursor (currently just "sort")
|
||||
if (isset($query['sort'])) {
|
||||
unset($query['query'], $query['fields']);
|
||||
$grouped[$cursor][count($grouped[$cursor]) - 1][] = $query;
|
||||
} else {
|
||||
$grouped[$cursor][] = array($query);
|
||||
$ordered[] =& $grouped[$cursor][count($grouped[$cursor]) - 1];
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$db = '';
|
||||
$query = '';
|
||||
foreach ($ordered as $logs) {
|
||||
foreach ($logs as $log) {
|
||||
if (isset($log['db']) && $db != $log['db']) {
|
||||
// for readability
|
||||
$this->formattedQueries[$i++] = 'use '.$log['db'].';';
|
||||
$db = $log['db'];
|
||||
}
|
||||
|
||||
if (isset($log['collection'])) {
|
||||
// flush the previous and start a new query
|
||||
if (!empty($query)) {
|
||||
if ('.' == $query[0]) {
|
||||
$query = 'db'.$query;
|
||||
}
|
||||
|
||||
$this->formattedQueries[$i++] = $query.';';
|
||||
++$this->nbRealQueries;
|
||||
}
|
||||
|
||||
$query = 'db.'.$log['collection'];
|
||||
}
|
||||
|
||||
// format the method call
|
||||
if (isset($log['authenticate'])) {
|
||||
$query .= '.authenticate()';
|
||||
} elseif (isset($log['batchInsert'])) {
|
||||
$query .= '.batchInsert(**'.$log['num'].' item(s)**)';
|
||||
} elseif (isset($log['command'])) {
|
||||
$query .= '.command()';
|
||||
} elseif (isset($log['count'])) {
|
||||
$query .= '.count(';
|
||||
if ($log['query'] || $log['limit'] || $log['skip']) {
|
||||
$query .= static::bsonEncode($log['query']);
|
||||
if ($log['limit'] || $log['skip']) {
|
||||
$query .= ', '.static::bsonEncode($log['limit']);
|
||||
if ($log['skip']) {
|
||||
$query .= ', '.static::bsonEncode($log['skip']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$query .= ')';
|
||||
} elseif (isset($log['createCollection'])) {
|
||||
$query .= '.createCollection()';
|
||||
} elseif (isset($log['createDBRef'])) {
|
||||
$query .= '.createDBRef()';
|
||||
} elseif (isset($log['deleteIndex'])) {
|
||||
$query .= '.dropIndex('.static::bsonEncode($log['keys']).')';
|
||||
} elseif (isset($log['deleteIndexes'])) {
|
||||
$query .= '.dropIndexes()';
|
||||
} elseif (isset($log['drop'])) {
|
||||
$query .= '.drop()';
|
||||
} elseif (isset($log['dropDatabase'])) {
|
||||
$query .= '.dropDatabase()';
|
||||
} elseif (isset($log['ensureIndex'])) {
|
||||
$query .= '.ensureIndex('.static::bsonEncode($log['keys']).', '.static::bsonEncode($log['options']).')';
|
||||
} elseif (isset($log['execute'])) {
|
||||
$query .= '.execute()';
|
||||
} elseif (isset($log['find'])) {
|
||||
$query .= '.find(';
|
||||
if ($log['query'] || $log['fields']) {
|
||||
$query .= static::bsonEncode($log['query']);
|
||||
if ($log['fields']) {
|
||||
$query .= ', '.static::bsonEncode($log['fields']);
|
||||
}
|
||||
}
|
||||
$query .= ')';
|
||||
} elseif (isset($log['findOne'])) {
|
||||
$query .= '.findOne(';
|
||||
if ($log['query'] || $log['fields']) {
|
||||
$query .= static::bsonEncode($log['query']);
|
||||
if ($log['fields']) {
|
||||
$query .= ', '.static::bsonEncode($log['fields']);
|
||||
}
|
||||
}
|
||||
$query .= ')';
|
||||
} elseif (isset($log['getDBRef'])) {
|
||||
$query .= '.getDBRef()';
|
||||
} elseif (isset($log['group'])) {
|
||||
$query .= '.group('.static::bsonEncode(array(
|
||||
'keys' => $log['keys'],
|
||||
'initial' => $log['initial'],
|
||||
'reduce' => $log['reduce'],
|
||||
)).')';
|
||||
} elseif (isset($log['insert'])) {
|
||||
$query .= '.insert('.static::bsonEncode($log['document']).')';
|
||||
} elseif (isset($log['remove'])) {
|
||||
$query .= '.remove('.static::bsonEncode($log['query']).')';
|
||||
} elseif (isset($log['save'])) {
|
||||
$query .= '.save('.static::bsonEncode($log['document']).')';
|
||||
} elseif (isset($log['sort'])) {
|
||||
$query .= '.sort('.static::bsonEncode($log['sortFields']).')';
|
||||
} elseif (isset($log['update'])) {
|
||||
// todo: include $log['options']
|
||||
$query .= '.update('.static::bsonEncode($log['query']).', '.static::bsonEncode($log['newObj']).')';
|
||||
} elseif (isset($log['validate'])) {
|
||||
$query .= '.validate()';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($query)) {
|
||||
if ('.' == $query[0]) {
|
||||
$query = 'db'.$query;
|
||||
}
|
||||
|
||||
$this->formattedQueries[$i++] = $query.';';
|
||||
++$this->nbRealQueries;
|
||||
}
|
||||
}
|
||||
|
||||
static protected function bsonEncode($query, $array = true)
|
||||
{
|
||||
$parts = array();
|
||||
|
||||
@ -88,10 +249,12 @@ class DoctrineMongoDBLogger
|
||||
|
||||
if (is_bool($value)) {
|
||||
$formatted = $value ? 'true' : 'false';
|
||||
} elseif (is_numeric($value)) {
|
||||
$formatted = $value;
|
||||
} elseif (is_scalar($value)) {
|
||||
$formatted = '"'.$value.'"';
|
||||
} elseif (is_array($value)) {
|
||||
$formatted = static::formatQuery($value);
|
||||
$formatted = static::bsonEncode($value);
|
||||
} elseif ($value instanceof \MongoId) {
|
||||
$formatted = 'ObjectId("'.$value.'")';
|
||||
} elseif ($value instanceof \MongoDate) {
|
||||
@ -107,7 +270,7 @@ class DoctrineMongoDBLogger
|
||||
} elseif ($value instanceof \MongoBinData) {
|
||||
$formatted = 'new BinData("'.$value->bin.'", "'.$value->type.'")';
|
||||
} elseif ($value instanceof \stdClass) {
|
||||
$formatted = static::formatQuery((array) $value, false);
|
||||
$formatted = static::bsonEncode((array) $value);
|
||||
} else {
|
||||
$formatted = (string) $value;
|
||||
}
|
||||
|
@ -4,116 +4,115 @@
|
||||
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.odm.mongodb.default_document_manager">default</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.default_connection">default</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.default_database">default</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata_cache_driver">array</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.connection_class">Doctrine\MongoDB\Connection</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.configuration_class">Doctrine\ODM\MongoDB\Configuration</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.document_manager_class">Doctrine\ODM\MongoDB\DocumentManager</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.logger_class">Symfony\Bundle\DoctrineMongoDBBundle\Logger\DoctrineMongoDBLogger</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.data_collector_class">Symfony\Bundle\DoctrineMongoDBBundle\DataCollector\DoctrineMongoDBDataCollector</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.event_manager_class">Doctrine\Common\EventManager</parameter>
|
||||
<parameters>
|
||||
<parameter key="doctrine.odm.mongodb.connection_class">Doctrine\MongoDB\Connection</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.configuration_class">Doctrine\ODM\MongoDB\Configuration</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.document_manager_class">Doctrine\ODM\MongoDB\DocumentManager</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.logger_class">Symfony\Bundle\DoctrineMongoDBBundle\Logger\DoctrineMongoDBLogger</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.data_collector_class">Symfony\Bundle\DoctrineMongoDBBundle\DataCollector\DoctrineMongoDBDataCollector</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.event_manager_class">Doctrine\Common\EventManager</parameter>
|
||||
|
||||
<!-- proxies -->
|
||||
<parameter key="doctrine.odm.mongodb.proxy_namespace">Proxies</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.proxy_dir">%kernel.cache_dir%/doctrine/odm/mongodb/Proxies</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.auto_generate_proxy_classes">false</parameter>
|
||||
<!-- proxies -->
|
||||
<parameter key="doctrine.odm.mongodb.proxy_namespace">Proxies</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.proxy_dir">%kernel.cache_dir%/doctrine/odm/mongodb/Proxies</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.auto_generate_proxy_classes">false</parameter>
|
||||
|
||||
<!-- hydrators -->
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_namespace">Hydrators</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_dir">%kernel.cache_dir%/doctrine/odm/mongodb/Hydrators</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.auto_generate_hydrator_classes">false</parameter>
|
||||
<!-- hydrators -->
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_namespace">Hydrators</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_dir">%kernel.cache_dir%/doctrine/odm/mongodb/Hydrators</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.auto_generate_hydrator_classes">false</parameter>
|
||||
|
||||
<!-- cache -->
|
||||
<parameter key="doctrine.odm.mongodb.cache.array_class">Doctrine\Common\Cache\ArrayCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.apc_class">Doctrine\Common\Cache\ApcCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_class">Doctrine\Common\Cache\MemcacheCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_host">localhost</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_port">11211</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_instance_class">Memcache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.xcache_class">Doctrine\Common\Cache\XcacheCache</parameter>
|
||||
<!-- cache -->
|
||||
<parameter key="doctrine.odm.mongodb.cache.array_class">Doctrine\Common\Cache\ArrayCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.apc_class">Doctrine\Common\Cache\ApcCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_class">Doctrine\Common\Cache\MemcacheCache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_host">localhost</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_port">11211</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.memcache_instance_class">Memcache</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.cache.xcache_class">Doctrine\Common\Cache\XcacheCache</parameter>
|
||||
|
||||
<!-- metadata -->
|
||||
<parameter key="doctrine.odm.mongodb.metadata.driver_chain_class">Doctrine\ODM\MongoDB\Mapping\Driver\DriverChain</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.annotation_class">Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.annotation_reader_class">Doctrine\Common\Annotations\AnnotationReader</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.xml_class">Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.yml_class">Doctrine\ODM\MongoDB\Mapping\Driver\YamlDriver</parameter>
|
||||
<!-- metadata -->
|
||||
<parameter key="doctrine.odm.mongodb.metadata.driver_chain_class">Doctrine\ODM\MongoDB\Mapping\Driver\DriverChain</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.annotation_class">Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.annotation_reader_class">Doctrine\Common\Annotations\AnnotationReader</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.xml_class">Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.metadata.yml_class">Doctrine\ODM\MongoDB\Mapping\Driver\YamlDriver</parameter>
|
||||
|
||||
<!-- directories -->
|
||||
<parameter key="doctrine.odm.mongodb.mapping_dirs" type="collection"></parameter>
|
||||
<parameter key="doctrine.odm.mongodb.xml_mapping_dirs">%doctrine.odm.mongodb.mapping_dirs%</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.yml_mapping_dirs">%doctrine.odm.mongodb.mapping_dirs%</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.document_dirs" type="collection"></parameter>
|
||||
<!-- directories -->
|
||||
<parameter key="doctrine.odm.mongodb.mapping_dirs" type="collection"></parameter>
|
||||
<parameter key="doctrine.odm.mongodb.xml_mapping_dirs">%doctrine.odm.mongodb.mapping_dirs%</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.yml_mapping_dirs">%doctrine.odm.mongodb.mapping_dirs%</parameter>
|
||||
<parameter key="doctrine.odm.mongodb.document_dirs" type="collection"></parameter>
|
||||
|
||||
<!-- security/user -->
|
||||
<parameter key="doctrine.odm.mongodb.security.user.provider.class">Symfony\Bundle\DoctrineMongoDBBundle\Security\DocumentUserProvider</parameter>
|
||||
<!-- security/user -->
|
||||
<parameter key="doctrine.odm.mongodb.security.user.provider.class">Symfony\Bundle\DoctrineMongoDBBundle\Security\DocumentUserProvider</parameter>
|
||||
|
||||
<!-- proxy cache warmer -->
|
||||
<parameter key="doctrine.odm.mongodb.proxy_cache_warmer.class">Symfony\Bundle\DoctrineMongoDBBundle\CacheWarmer\ProxyCacheWarmer</parameter>
|
||||
<!-- proxy cache warmer -->
|
||||
<parameter key="doctrine.odm.mongodb.proxy_cache_warmer.class">Symfony\Bundle\DoctrineMongoDBBundle\CacheWarmer\ProxyCacheWarmer</parameter>
|
||||
|
||||
<!-- hydrator cache warmer -->
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_cache_warmer.class">Symfony\Bundle\DoctrineMongoDBBundle\CacheWarmer\HydratorCacheWarmer</parameter>
|
||||
<!-- hydrator cache warmer -->
|
||||
<parameter key="doctrine.odm.mongodb.hydrator_cache_warmer.class">Symfony\Bundle\DoctrineMongoDBBundle\CacheWarmer\HydratorCacheWarmer</parameter>
|
||||
|
||||
<!-- validator -->
|
||||
<parameter key="doctrine_odm.mongodb.validator.unique.class">Symfony\Bundle\DoctrineMongoDBBundle\Validator\Constraints\UniqueValidator</parameter>
|
||||
</parameters>
|
||||
<!-- validator -->
|
||||
<parameter key="doctrine_odm.mongodb.validator.unique.class">Symfony\Bundle\DoctrineMongoDBBundle\Validator\Constraints\UniqueValidator</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<!-- defaults -->
|
||||
<service id="doctrine.odm.mongodb.cache" alias="doctrine.odm.mongodb.cache.array" />
|
||||
<services>
|
||||
<!-- defaults -->
|
||||
<service id="doctrine.odm.mongodb.cache" alias="doctrine.odm.mongodb.cache.array" />
|
||||
|
||||
<!-- metadata -->
|
||||
<service id="doctrine.odm.mongodb.metadata.chain" class="%doctrine.odm.mongodb.metadata.driver_chain_class%" />
|
||||
<service id="doctrine.odm.mongodb.metadata.annotation" class="%doctrine.odm.mongodb.metadata.annotation_class%">
|
||||
<argument type="service" id="doctrine.odm.mongodb.metadata.annotation_reader" />
|
||||
<argument>%doctrine.odm.mongodb.document_dirs%</argument>
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.metadata.annotation_reader" class="%doctrine.odm.mongodb.metadata.annotation_reader_class%">
|
||||
<argument type="service" id="doctrine.odm.mongodb.cache" />
|
||||
<call method="setAnnotationNamespaceAlias">
|
||||
<argument>Doctrine\ODM\MongoDB\Mapping\</argument>
|
||||
<argument>mongodb</argument>
|
||||
</call>
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.metadata.xml" class="%doctrine.odm.mongodb.metadata.xml_class%"><argument>%doctrine.odm.mongodb.xml_mapping_dirs%</argument></service>
|
||||
<service id="doctrine.odm.mongodb.metadata.yml" class="%doctrine.odm.mongodb.metadata.yml_class%"><argument>%doctrine.odm.mongodb.yml_mapping_dirs%</argument></service>
|
||||
<!-- metadata -->
|
||||
<service id="doctrine.odm.mongodb.metadata.chain" class="%doctrine.odm.mongodb.metadata.driver_chain_class%" />
|
||||
<service id="doctrine.odm.mongodb.metadata.annotation" class="%doctrine.odm.mongodb.metadata.annotation_class%">
|
||||
<argument type="service" id="doctrine.odm.mongodb.metadata.annotation_reader" />
|
||||
<argument>%doctrine.odm.mongodb.document_dirs%</argument>
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.metadata.annotation_reader" class="%doctrine.odm.mongodb.metadata.annotation_reader_class%">
|
||||
<argument type="service" id="doctrine.odm.mongodb.cache" />
|
||||
<call method="setAnnotationNamespaceAlias">
|
||||
<argument>Doctrine\ODM\MongoDB\Mapping\</argument>
|
||||
<argument>mongodb</argument>
|
||||
</call>
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.metadata.xml" class="%doctrine.odm.mongodb.metadata.xml_class%">
|
||||
<argument>%doctrine.odm.mongodb.xml_mapping_dirs%</argument>
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.metadata.yml" class="%doctrine.odm.mongodb.metadata.yml_class%">
|
||||
<argument>%doctrine.odm.mongodb.yml_mapping_dirs%</argument>
|
||||
</service>
|
||||
|
||||
<!-- cache -->
|
||||
<service id="doctrine.odm.mongodb.cache.array" class="%doctrine.odm.mongodb.cache.array_class%" />
|
||||
<!-- cache -->
|
||||
<service id="doctrine.odm.mongodb.cache.array" class="%doctrine.odm.mongodb.cache.array_class%" />
|
||||
|
||||
<!-- logger -->
|
||||
<service id="doctrine.odm.mongodb.logger" class="%doctrine.odm.mongodb.logger_class%">
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.data_collector" class="%doctrine.odm.mongodb.data_collector_class%" public="false">
|
||||
<tag name="data_collector" template="DoctrineMongoDBBundle:Collector:mongodb" id="mongodb" />
|
||||
<argument type="service" id="doctrine.odm.mongodb.logger" />
|
||||
</service>
|
||||
<!-- logger -->
|
||||
<service id="doctrine.odm.mongodb.logger" class="%doctrine.odm.mongodb.logger_class%">
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.data_collector" class="%doctrine.odm.mongodb.data_collector_class%" public="false">
|
||||
<tag name="data_collector" template="DoctrineMongoDBBundle:Collector:mongodb" id="mongodb" />
|
||||
<argument type="service" id="doctrine.odm.mongodb.logger" />
|
||||
</service>
|
||||
|
||||
<!-- Cache Warmers -->
|
||||
<service id="doctrine.odm.mongodb.proxy_cache_warmer" class="%doctrine.odm.mongodb.proxy_cache_warmer.class%" public="false">
|
||||
<tag name="kernel.cache_warmer" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.hydrator_cache_warmer" class="%doctrine.odm.mongodb.hydrator_cache_warmer.class%" public="false">
|
||||
<tag name="kernel.cache_warmer" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<!-- Cache Warmers -->
|
||||
<service id="doctrine.odm.mongodb.proxy_cache_warmer" class="%doctrine.odm.mongodb.proxy_cache_warmer.class%" public="false">
|
||||
<tag name="kernel.cache_warmer" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.hydrator_cache_warmer" class="%doctrine.odm.mongodb.hydrator_cache_warmer.class%" public="false">
|
||||
<tag name="kernel.cache_warmer" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<!-- validator -->
|
||||
<service id="doctrine_odm.mongodb.validator.unique" class="%doctrine_odm.mongodb.validator.unique.class%">
|
||||
<tag name="validator.constraint_validator" alias="doctrine_odm.mongodb.unique" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<!-- validator -->
|
||||
<service id="doctrine_odm.mongodb.validator.unique" class="%doctrine_odm.mongodb.validator.unique.class%">
|
||||
<tag name="validator.constraint_validator" alias="doctrine_odm.mongodb.unique" />
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<!-- Security -->
|
||||
<service id="doctrine.odm.mongodb.security.user.provider" class="%doctrine.odm.mongodb.security.user.provider.class%" public="false" abstract="true">
|
||||
<argument type="service" id="doctrine.odm.mongodb.security.user.document_manager" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.security.user.document_manager" alias="doctrine.odm.mongodb.default_document_manager" public="false" />
|
||||
|
||||
</services>
|
||||
<!-- Security -->
|
||||
<service id="doctrine.odm.mongodb.security.user.provider" class="%doctrine.odm.mongodb.security.user.provider.class%" public="false" abstract="true">
|
||||
<argument type="service" id="doctrine.odm.mongodb.security.user.document_manager" />
|
||||
</service>
|
||||
<service id="doctrine.odm.mongodb.security.user.document_manager" alias="doctrine.odm.mongodb.default_document_manager" public="false" />
|
||||
</services>
|
||||
</container>
|
@ -8,7 +8,8 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<span class="picto">
|
||||
<span class="label">
|
||||
<span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/db.png') }}" alt="" /></span>
|
||||
<strong>Doctrine MongoDB</strong>
|
||||
<span class="count">
|
||||
<span>{{ collector.querycount }}</span>
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\Security;
|
||||
|
||||
use Symfony\Component\Security\Core\User\AccountInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedAccountException;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||
|
||||
class DocumentUserProvider implements UserProviderInterface
|
||||
@ -59,13 +59,13 @@ class DocumentUserProvider implements UserProviderInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function loadUserByAccount(AccountInterface $account)
|
||||
public function loadUser(UserInterface $user)
|
||||
{
|
||||
if (!$account instanceof $this->class) {
|
||||
throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));
|
||||
if (!$user instanceof $this->class) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
|
||||
}
|
||||
|
||||
return $this->loadUserByUsername($account->getUsername());
|
||||
return $this->loadUserByUsername($user->getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,10 @@ class ContainerTest extends TestCase
|
||||
)));
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
$container->registerExtension($loader);
|
||||
$loader->load(array('mappings' => array('YamlBundle' => array())), $container);
|
||||
|
||||
$configs = array();
|
||||
$configs[] = array('connections' => array('default' => array()), 'document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))));
|
||||
$loader->load($configs, $container);
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$config = array(
|
||||
'proxy_namespace' => 'MyProxies',
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'connections' => array('default' => array()),
|
||||
'document_managers' => array('default' => array())
|
||||
);
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
@ -80,8 +82,13 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
|
||||
$config = array(
|
||||
'server' => 'mongodb://localhost:27017',
|
||||
'options' => array('connect' => true)
|
||||
'connections' => array(
|
||||
'default' => array(
|
||||
'server' => 'mongodb://localhost:27017',
|
||||
'options' => array('connect' => true)
|
||||
)
|
||||
),
|
||||
'document_managers' => array('default' => array())
|
||||
);
|
||||
$loader->load(array($config), $container);
|
||||
|
||||
@ -218,7 +225,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
|
||||
$loader->load(array(array('mappings' => array('YamlBundle' => array()))), $container);
|
||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))))), $container);
|
||||
|
||||
$definition = $container->getDefinition('doctrine.odm.mongodb.default_configuration');
|
||||
$calls = $definition->getMethodCalls();
|
||||
@ -231,7 +238,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$container = $this->getContainer();
|
||||
$loader = new DoctrineMongoDBExtension('YamlBundle');
|
||||
|
||||
$loader->load(array(array('mappings' => array('YamlBundle' => array()))), $container);
|
||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))))), $container);
|
||||
|
||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||
$this->assertEquals('doctrine.odm.mongodb.default_yml_metadata_driver', (string) $calls[0][1][0]);
|
||||
@ -243,7 +250,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$container = $this->getContainer('XmlBundle');
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
|
||||
$loader->load(array(array('mappings' => array('XmlBundle' => array()))), $container);
|
||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('XmlBundle' => array()))))), $container);
|
||||
|
||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||
$this->assertEquals('doctrine.odm.mongodb.default_xml_metadata_driver', (string) $calls[0][1][0]);
|
||||
@ -255,7 +262,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$container = $this->getContainer('AnnotationsBundle');
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
|
||||
$loader->load(array(array('mappings' => array('AnnotationsBundle' => array()))), $container);
|
||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array()))))), $container);
|
||||
|
||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||
$this->assertEquals('doctrine.odm.mongodb.default_annotation_metadata_driver', (string) $calls[0][1][0]);
|
||||
@ -321,7 +328,6 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
$container->compile();
|
||||
|
||||
$this->assertEquals('apc', $container->getParameter('doctrine.odm.mongodb.metadata_cache_driver'));
|
||||
$this->assertTrue($container->getParameter('doctrine.odm.mongodb.auto_generate_proxy_classes'));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\Tests\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Bundle\DoctrineMongoDBBundle\DependencyInjection\Configuration;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testDefaults()
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$options = $processor->process($configuration->getConfigTree(), array());
|
||||
|
||||
$defaults = array(
|
||||
'auto_generate_hydrator_classes' => false,
|
||||
'auto_generate_proxy_classes' => false,
|
||||
'default_document_manager' => 'default',
|
||||
'default_database' => 'default',
|
||||
'document_managers' => array(),
|
||||
'default_connection' => 'default',
|
||||
'connections' => array(),
|
||||
'proxy_namespace' => 'Proxies',
|
||||
'hydrator_namespace' => 'Hydrators',
|
||||
);
|
||||
|
||||
foreach ($defaults as $key => $default) {
|
||||
$this->assertTrue(array_key_exists($key, $options), sprintf('The default "%s" exists', $key));
|
||||
$this->assertEquals($default, $options[$key]);
|
||||
|
||||
unset($options[$key]);
|
||||
}
|
||||
|
||||
if (count($options)) {
|
||||
$this->fail('Extra defaults were returned: '. print_r($options, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests a full configuration.
|
||||
*
|
||||
* @dataProvider fullConfigurationProvider
|
||||
*/
|
||||
public function testFullConfiguration($config)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$options = $processor->process($configuration->getConfigTree(), array($config));
|
||||
|
||||
$expected = array(
|
||||
'proxy_namespace' => 'Test_Proxies',
|
||||
'auto_generate_proxy_classes' => true,
|
||||
'hydrator_namespace' => 'Test_Hydrators',
|
||||
'auto_generate_hydrator_classes' => true,
|
||||
'default_document_manager' => 'default_dm_name',
|
||||
'default_database' => 'default_db_name',
|
||||
'default_connection' => 'conn1',
|
||||
'connections' => array(
|
||||
'conn1' => array(
|
||||
'server' => 'http://server',
|
||||
'options' => array(
|
||||
'connect' => true,
|
||||
'persist' => 'persist_val',
|
||||
'timeout' => 500,
|
||||
'replicaSet' => true,
|
||||
'username' => 'username_val',
|
||||
'password' => 'password_val',
|
||||
),
|
||||
),
|
||||
'conn2' => array(
|
||||
'server' => 'http://server2',
|
||||
'options' => array(),
|
||||
),
|
||||
),
|
||||
'document_managers' => array(
|
||||
'dm1' => array(
|
||||
'mappings' => array(
|
||||
'FooBundle' => array(
|
||||
'type' => 'annotations',
|
||||
),
|
||||
),
|
||||
'metadata_cache_driver' => array(
|
||||
'type' => 'memcache',
|
||||
'class' => 'fooClass',
|
||||
'host' => 'host_val',
|
||||
'port' => 1234,
|
||||
'instance_class' => 'instance_val',
|
||||
),
|
||||
),
|
||||
'dm2' => array(
|
||||
'connection' => 'dm2_connection',
|
||||
'database' => 'db1',
|
||||
'mappings' => array(
|
||||
'BarBundle' => array(
|
||||
'type' => 'yml',
|
||||
'dir' => '%kernel.cache_dir%',
|
||||
'prefix' => 'prefix_val',
|
||||
'alias' => 'alias_val',
|
||||
'is_bundle' => false,
|
||||
)
|
||||
),
|
||||
'metadata_cache_driver' => array(
|
||||
'type' => 'apc',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $options);
|
||||
}
|
||||
|
||||
public function fullConfigurationProvider()
|
||||
{
|
||||
$yaml = Yaml::load(__DIR__.'/Fixtures/config/yml/full.yml');
|
||||
$yaml = $yaml['doctrine_mongo_db'];
|
||||
|
||||
return array(
|
||||
array($yaml),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider optionProvider
|
||||
* @param array $configs The source array of configuration arrays
|
||||
* @param array $correctValues A key-value pair of end values to check
|
||||
*/
|
||||
public function testMergeOptions(array $configs, array $correctValues)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$options = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
foreach ($correctValues as $key => $correctVal)
|
||||
{
|
||||
$this->assertEquals($correctVal, $options[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
public function optionProvider()
|
||||
{
|
||||
$cases = array();
|
||||
|
||||
// single config, testing normal option setting
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('default_document_manager' => 'foo'),
|
||||
),
|
||||
array('default_document_manager' => 'foo')
|
||||
);
|
||||
|
||||
// single config, testing normal option setting with dashes
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('default-document-manager' => 'bar'),
|
||||
),
|
||||
array('default_document_manager' => 'bar')
|
||||
);
|
||||
|
||||
// testing the normal override merging - the later config array wins
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('default_document_manager' => 'foo'),
|
||||
array('default_document_manager' => 'baz'),
|
||||
),
|
||||
array('default_document_manager' => 'baz')
|
||||
);
|
||||
|
||||
// the "options" array is totally replaced
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('connections' => array('default' => array('options' => array('timeout' => 2000)))),
|
||||
array('connections' => array('default' => array('options' => array('username' => 'foo')))),
|
||||
),
|
||||
array('connections' => array('default' => array('options' => array('username' => 'foo'), 'server' => null))),
|
||||
);
|
||||
|
||||
// mappings are merged non-recursively.
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('document_managers' => array('default' => array('mappings' => array('foomap' => array('type' => 'val1'), 'barmap' => array('dir' => 'val2'))))),
|
||||
array('document_managers' => array('default' => array('mappings' => array('barmap' => array('prefix' => 'val3'))))),
|
||||
),
|
||||
array('document_managers' => array('default' => array('mappings' => array('foomap' => array('type' => 'val1'), 'barmap' => array('prefix' => 'val3'))))),
|
||||
);
|
||||
|
||||
// connections are merged non-recursively.
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('connections' => array('foocon' => array('server' => 'val1'), 'barcon' => array('options' => array('username' => 'val2')))),
|
||||
array('connections' => array('barcon' => array('server' => 'val3'))),
|
||||
),
|
||||
array('connections' => array(
|
||||
'foocon' => array('server' => 'val1', 'options' => array()),
|
||||
'barcon' => array('server' => 'val3', 'options' => array())
|
||||
)),
|
||||
);
|
||||
|
||||
// managers are merged non-recursively.
|
||||
$cases[] = array(
|
||||
array(
|
||||
array('document_managers' => array('foodm' => array('database' => 'val1'), 'bardm' => array('database' => 'val2'))),
|
||||
array('document_managers' => array('bardm' => array('database' => 'val3'))),
|
||||
),
|
||||
array('document_managers' => array(
|
||||
'foodm' => array('database' => 'val1', 'mappings' => array()),
|
||||
'bardm' => array('database' => 'val3', 'mappings' => array()),
|
||||
)),
|
||||
);
|
||||
|
||||
return $cases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getNormalizationTests
|
||||
*/
|
||||
public function testNormalizeOptions(array $config, $targetKey, array $normalized)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$options = $processor->process($configuration->getConfigTree(), array($config));
|
||||
$this->assertSame($normalized, $options[$targetKey]);
|
||||
}
|
||||
|
||||
public function getNormalizationTests()
|
||||
{
|
||||
return array(
|
||||
// connection versus connections (id is the identifier)
|
||||
array(
|
||||
array('connection' => array(
|
||||
array('server' => 'mongodb://abc', 'id' => 'foo'),
|
||||
array('server' => 'mongodb://def', 'id' => 'bar'),
|
||||
)),
|
||||
'connections',
|
||||
array(
|
||||
'foo' => array('server' => 'mongodb://abc', 'options' => array()),
|
||||
'bar' => array('server' => 'mongodb://def', 'options' => array()),
|
||||
),
|
||||
),
|
||||
// document_manager versus document_managers (id is the identifier)
|
||||
array(
|
||||
array('document_manager' => array(
|
||||
array('connection' => 'conn1', 'id' => 'foo'),
|
||||
array('connection' => 'conn2', 'id' => 'bar'),
|
||||
)),
|
||||
'document_managers',
|
||||
array(
|
||||
'foo' => array('connection' => 'conn1', 'mappings' => array()),
|
||||
'bar' => array('connection' => 'conn2', 'mappings' => array()),
|
||||
),
|
||||
),
|
||||
// mapping configuration that's beneath a specific document manager
|
||||
array(
|
||||
array('document_manager' => array(
|
||||
array('id' => 'foo', 'connection' => 'conn1', 'mapping' => array(
|
||||
'type' => 'xml', 'name' => 'foo-mapping'
|
||||
)),
|
||||
)),
|
||||
'document_managers',
|
||||
array(
|
||||
'foo' => array('connection' => 'conn1', 'mappings' => array(
|
||||
'foo-mapping' => array('type' => 'xml'),
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\Tests\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Bundle\DoctrineMongoDBBundle\DependencyInjection\DoctrineMongoDBExtension;
|
||||
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
class DoctrineMongoDBExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider parameterProvider
|
||||
*/
|
||||
public function testParameterOverride($option, $parameter, $value)
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new DoctrineMongoDBExtension();
|
||||
$loader->load(array(array($option => $value)), $container);
|
||||
|
||||
$this->assertEquals($value, $container->getParameter('doctrine.odm.mongodb.'.$parameter));
|
||||
}
|
||||
|
||||
public function parameterProvider()
|
||||
{
|
||||
return array(
|
||||
array('proxy_namespace', 'proxy_namespace', 'foo'),
|
||||
array('proxy-namespace', 'proxy_namespace', 'bar'),
|
||||
);
|
||||
}
|
||||
}
|
@ -7,27 +7,23 @@
|
||||
http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">
|
||||
|
||||
<doctrine:mongodb
|
||||
metadata-cache-driver="apc"
|
||||
default-document-manager="dm2"
|
||||
default-connection="conn1"
|
||||
proxy-namespace="Proxies"
|
||||
auto-generate-proxy-classes="true"
|
||||
>
|
||||
<doctrine:connections>
|
||||
<doctrine:connection id="conn1" server="mongodb://localhost:27017">
|
||||
<options>
|
||||
<connect>true</connect>
|
||||
</options>
|
||||
</doctrine:connection>
|
||||
<doctrine:connection id="conn2" server="mongodb://localhost:27017">
|
||||
<options>
|
||||
<connect>true</connect>
|
||||
</options>
|
||||
</doctrine:connection>
|
||||
</doctrine:connections>
|
||||
<doctrine:document-managers>
|
||||
<doctrine:document-manager id="dm1" metadata-cache-driver="xcache" connection="conn1" />
|
||||
<doctrine:document-manager id="dm2" connection="conn2" />
|
||||
</doctrine:document-managers>
|
||||
<doctrine:connection id="conn1" server="mongodb://localhost:27017">
|
||||
<doctrine:options>
|
||||
<doctrine:connect>true</doctrine:connect>
|
||||
</doctrine:options>
|
||||
</doctrine:connection>
|
||||
<doctrine:connection id="conn2" server="mongodb://localhost:27017">
|
||||
<doctrine:options>
|
||||
<doctrine:connect>true</doctrine:connect>
|
||||
</doctrine:options>
|
||||
</doctrine:connection>
|
||||
|
||||
<doctrine:document-manager id="dm1" metadata-cache-driver="xcache" connection="conn1" />
|
||||
<doctrine:document-manager id="dm2" connection="conn2" metadata-cache-driver="apc" />
|
||||
</doctrine:mongodb>
|
||||
</container>
|
@ -6,15 +6,19 @@
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">
|
||||
|
||||
<doctrine:mongodb server="mongodb://localhost:27017" default_database="mydb">
|
||||
<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>
|
||||
<options>
|
||||
<connect>true</connect>
|
||||
</options>
|
||||
<doctrine:mongodb default_database="mydb">
|
||||
<doctrine:connection server="mongodb://localhost:27017" id="default">
|
||||
<doctrine:options>
|
||||
<doctrine:connect>true</doctrine:connect>
|
||||
</doctrine:options>
|
||||
</doctrine:connection>
|
||||
<doctrine:document-manager id="default" connection="default">
|
||||
<doctrine:metadata-cache-driver type="memcache">
|
||||
<doctrine:class>Doctrine\Common\Cache\MemcacheCache</doctrine:class>
|
||||
<doctrine:host>localhost</doctrine:host>
|
||||
<doctrine:port>11211</doctrine:port>
|
||||
<doctrine:instance-class>Memcache</doctrine:instance-class>
|
||||
</doctrine:metadata-cache-driver>
|
||||
</doctrine:document-manager>
|
||||
</doctrine:mongodb>
|
||||
</container>
|
@ -7,22 +7,21 @@
|
||||
http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">
|
||||
|
||||
<doctrine:mongodb>
|
||||
<doctrine:connections>
|
||||
<doctrine:connection id="default" server="mongodb://localhost:27017">
|
||||
<options>
|
||||
<connect>true</connect>
|
||||
</options>
|
||||
</doctrine:connection>
|
||||
</doctrine:connections>
|
||||
<doctrine:document-managers>
|
||||
<doctrine:document-manager id="default" connection="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>
|
||||
</doctrine:document-manager>
|
||||
</doctrine:document-managers>
|
||||
|
||||
<doctrine:connection id="default" server="mongodb://localhost:27017">
|
||||
<doctrine:options>
|
||||
<doctrine:connect>true</doctrine:connect>
|
||||
</doctrine:options>
|
||||
</doctrine:connection>
|
||||
|
||||
<doctrine:document-manager id="default" connection="default">
|
||||
<doctrine:metadata-cache-driver type="memcache">
|
||||
<doctrine:class>Doctrine\Common\Cache\MemcacheCache</doctrine:class>
|
||||
<doctrine:host>localhost</doctrine:host>
|
||||
<doctrine:port>11211</doctrine:port>
|
||||
<doctrine:instance-class>Memcache</doctrine:instance-class>
|
||||
</doctrine:metadata-cache-driver>
|
||||
</doctrine:document-manager>
|
||||
|
||||
</doctrine:mongodb>
|
||||
</container>
|
@ -8,7 +8,6 @@
|
||||
|
||||
<doctrine:mongodb
|
||||
auto-generate-proxy-classes="false"
|
||||
metadata-cache-driver="apc"
|
||||
>
|
||||
</doctrine:mongodb>
|
||||
</container>
|
||||
|
@ -0,0 +1,46 @@
|
||||
doctrine_mongo_db:
|
||||
proxy_namespace: Test_Proxies
|
||||
auto_generate_proxy_classes: true
|
||||
|
||||
hydrator_namespace: Test_Hydrators
|
||||
auto_generate_hydrator_classes: true
|
||||
|
||||
default_document_manager: default_dm_name
|
||||
default_database: default_db_name
|
||||
|
||||
default_connection: conn1
|
||||
|
||||
connections:
|
||||
conn1:
|
||||
server: http://server
|
||||
options:
|
||||
connect: true
|
||||
persist: persist_val
|
||||
timeout: 500
|
||||
replicaSet: true
|
||||
username: username_val
|
||||
password: password_val
|
||||
conn2:
|
||||
server: http://server2
|
||||
|
||||
document_managers:
|
||||
dm1:
|
||||
mappings:
|
||||
FooBundle: annotations
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: fooClass
|
||||
host: host_val
|
||||
port: 1234
|
||||
instance_class: instance_val
|
||||
dm2:
|
||||
connection: dm2_connection
|
||||
database: db1
|
||||
mappings:
|
||||
BarBundle:
|
||||
type: yml
|
||||
dir: %kernel.cache_dir%
|
||||
prefix: prefix_val
|
||||
alias: alias_val
|
||||
is_bundle: false
|
||||
metadata_cache_driver: apc
|
@ -1,7 +1,6 @@
|
||||
doctrine_mongo_db:
|
||||
default_document_manager: dm2
|
||||
default_connection: conn2
|
||||
metadata_cache_driver: apc
|
||||
connections:
|
||||
conn1:
|
||||
server: mongodb://localhost:27017
|
||||
@ -17,3 +16,4 @@ doctrine_mongo_db:
|
||||
metadata_cache_driver: xcache
|
||||
dm2:
|
||||
connection: conn2
|
||||
metadata_cache_driver: apc
|
||||
|
@ -1,10 +1,14 @@
|
||||
doctrine_mongo_db:
|
||||
server: mongodb://localhost:27017
|
||||
connections:
|
||||
default:
|
||||
server: mongodb://localhost:27017
|
||||
options: { connect: true }
|
||||
default_database: mydb
|
||||
options: { connect: true }
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
||||
document_managers:
|
||||
default:
|
||||
metadata_cache_driver:
|
||||
type: memcache
|
||||
class: Doctrine\Common\Cache\MemcacheCache
|
||||
host: localhost
|
||||
port: 11211
|
||||
instance_class: Memcache
|
@ -1,3 +1,2 @@
|
||||
doctrine_mongo_db:
|
||||
auto_generate_proxy_classes: false
|
||||
metadata_cache_driver: apc
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\DoctrineMongoDBBundle\Tests\Logger;
|
||||
|
||||
use Symfony\Bundle\DoctrineMongoDBBundle\Logger\DoctrineMongoDBLogger;
|
||||
|
||||
class DoctrineMongoDBLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $logger;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->logger = new DoctrineMongoDBLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getQueries
|
||||
*/
|
||||
public function testLogger($query, $formatted)
|
||||
{
|
||||
$this->logger->logQuery($query);
|
||||
|
||||
$this->assertEquals($formatted, $this->logger->getQueries());
|
||||
}
|
||||
|
||||
public function getQueries()
|
||||
{
|
||||
return array(
|
||||
// batchInsert
|
||||
array(
|
||||
array('db' => 'foo', 'collection' => 'bar', 'batchInsert' => true, 'num' => 1, 'data' => array('foo'), 'options' => array()),
|
||||
array('use foo;', 'db.bar.batchInsert(**1 item(s)**);'),
|
||||
),
|
||||
// find
|
||||
array(
|
||||
array('db' => 'foo', 'collection' => 'bar', 'find' => true, 'query' => array(), 'fields' => array()),
|
||||
array('use foo;', 'db.bar.find();'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -32,6 +32,6 @@ abstract class Command extends BaseCommand
|
||||
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->container = $this->application->getKernel()->getContainer();
|
||||
$this->container = $this->getApplication()->getKernel()->getContainer();
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ EOF
|
||||
$format = '%-'.$maxName.'s %-'.$maxMethod.'s %s';
|
||||
|
||||
// displays the generated routes
|
||||
$format1 = '%-'.($maxName + 9).'s %-'.($maxMethod + 9).'s %s';
|
||||
$format1 = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %s';
|
||||
$output->writeln(sprintf($format1, '<comment>Name</comment>', '<comment>Method</comment>', '<comment>Pattern</comment>'));
|
||||
foreach ($routes as $name => $route) {
|
||||
$requirements = $route->getRequirements();
|
||||
|
@ -25,7 +25,7 @@ use Symfony\Component\HttpKernel\Kernel;
|
||||
*/
|
||||
class Application extends BaseApplication
|
||||
{
|
||||
protected $kernel;
|
||||
private $kernel;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -36,9 +36,9 @@ class Application extends BaseApplication
|
||||
|
||||
parent::__construct('Symfony', Kernel::VERSION.' - '.$kernel->getName().'/'.$kernel->getEnvironment().($kernel->isDebug() ? '/debug' : ''));
|
||||
|
||||
$this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
|
||||
$this->definition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
|
||||
$this->definition->addOption(new InputOption('--debug', '-d', InputOption::VALUE_NONE, 'Whether to run in debug mode.'));
|
||||
$this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
|
||||
$this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
|
||||
$this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
|
||||
|
||||
$this->kernel->boot();
|
||||
|
||||
|
@ -44,24 +44,36 @@ class TraceableEventManager extends ContainerAwareEventManager implements Tracea
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
|
||||
protected function triggerListener($listener, $eventName, EventArgs $eventArgs)
|
||||
{
|
||||
parent::dispatchEvent($eventName, $eventArgs);
|
||||
}
|
||||
parent::triggerListener($listener, $eventName, $eventArgs);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function notify(EventInterface $event)
|
||||
{
|
||||
foreach ($this->getListeners($event->getName()) as $listener) {
|
||||
if (is_array($listener) && is_string($listener[0])) {
|
||||
$listener[0] = $this->container->get($listener[0]);
|
||||
$listenerString = $this->listenerToString($listener);
|
||||
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->debug(sprintf('Notified event "%s" to listener "%s"', $eventName, $listenerString));
|
||||
}
|
||||
|
||||
$this->called[$eventName.'.'.$listenerString] = array(
|
||||
'event' => $eventName,
|
||||
'listener' => $listenerString,
|
||||
);
|
||||
|
||||
if ($eventArgs->isPropagationStopped() && null !== $this->logger) {
|
||||
$this->logger->debug(sprintf('Listener "%s" stopped propagation of the event "%s"', $this->listenerToString($listener), $eventName));
|
||||
|
||||
$skippedListeners = $this->getListeners($eventName);
|
||||
$skipped = false;
|
||||
|
||||
foreach ($skippedListeners as $skippedListener) {
|
||||
if ($skipped) {
|
||||
$this->logger->debug(sprintf('Listener "%s" was not called for event "%s"', $this->listenerToString($skippedListener), $eventName));
|
||||
}
|
||||
|
||||
if ($skippedListener === $listener) {
|
||||
$skipped = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->addCall($event, $listener, 'notify');
|
||||
|
||||
call_user_func($listener, $event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,10 +94,6 @@ class TraceableEventManager extends ContainerAwareEventManager implements Tracea
|
||||
|
||||
foreach (array_keys($this->listeners) as $name) {
|
||||
foreach ($this->getListeners($name) as $listener) {
|
||||
if (is_array($listener) && is_string($listener[0])) {
|
||||
$listener[0] = $this->container->get($listener[0]);
|
||||
}
|
||||
|
||||
$listener = $this->listenerToString($listener);
|
||||
|
||||
if (!isset($this->called[$name.'.'.$listener])) {
|
||||
@ -100,32 +108,18 @@ class TraceableEventManager extends ContainerAwareEventManager implements Tracea
|
||||
return $notCalled;
|
||||
}
|
||||
|
||||
protected function listenerToString($listener)
|
||||
protected function listenerToString($listener, $eventName)
|
||||
{
|
||||
if (is_object($listener) && $listener instanceof \Closure) {
|
||||
return 'Closure';
|
||||
}
|
||||
if (is_object($listener)) {
|
||||
if ($listener instanceof \Closure) {
|
||||
return 'Closure';
|
||||
}
|
||||
|
||||
if (is_string($listener)) {
|
||||
return $listener;
|
||||
return get_class($listener).'::'.$eventName;
|
||||
}
|
||||
|
||||
if (is_array($listener)) {
|
||||
return sprintf('%s::%s', is_object($listener[0]) ? get_class($listener[0]) : $listener[0], $listener[1]);
|
||||
return is_object($listener[0]) ? sprintf('%s::%s', get_class($listener[0]), $listener[1]) : implode('::', $listener);
|
||||
}
|
||||
}
|
||||
|
||||
protected function addCall(EventInterface $event, $listener, $type)
|
||||
{
|
||||
$listener = $this->listenerToString($listener);
|
||||
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->debug(sprintf('Notified event "%s" to listener "%s" (%s)', $event->getName(), $listener, $type));
|
||||
}
|
||||
|
||||
$this->called[$event->getName().'.'.$listener] = array(
|
||||
'event' => $event->getName(),
|
||||
'listener' => $listener,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,11 @@ class ProfilerPass implements CompilerPassInterface
|
||||
foreach ($container->findTaggedServiceIds('data_collector') as $id => $attributes) {
|
||||
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
|
||||
$template = null;
|
||||
if (isset($attributes[0]['template']) && isset($attributes[0]['id'])) {
|
||||
|
||||
if (isset($attributes[0]['template'])) {
|
||||
if (!isset($attributes[0]['id'])) {
|
||||
throw new \InvalidArgumentException(sprintf('Data collector service "%s" must have an id attribute in order to specify a template', $id));
|
||||
}
|
||||
$template = array($attributes[0]['id'], $attributes[0]['template']);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ class RegisterKernelListenersPass implements CompilerPassInterface
|
||||
foreach ($events as $event) {
|
||||
$priority = isset($event['priority']) ? $event['priority'] : 0;
|
||||
|
||||
var_dump($id);
|
||||
|
||||
if (!isset($event['event'])) {
|
||||
$definition->addMethodCall('addEventSubscriberService', array($id, $priority));
|
||||
} else {
|
||||
|
@ -144,7 +144,19 @@ class Configuration
|
||||
->arrayNode('templating')
|
||||
->canBeUnset()
|
||||
->scalarNode('assets_version')->end()
|
||||
->scalarNode('assets_base_urls')->end()
|
||||
->fixXmlConfig('assets_base_url')
|
||||
->arrayNode('assets_base_urls')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function($v){ return !is_array($v); })
|
||||
->then(function($v){ return array($v); })
|
||||
->end()
|
||||
->prototype('scalar')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function($v) { return is_array($v) && isset($v['value']); })
|
||||
->then(function($v){ return $v['value']; })
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('cache')->end()
|
||||
->scalarNode('cache_warmer')->end()
|
||||
->fixXmlConfig('engine')
|
||||
|
@ -46,7 +46,7 @@ class ProfilerListener
|
||||
/**
|
||||
* Handles the onCoreException event.
|
||||
*
|
||||
* @param EventInterface $event An EventInterface instance
|
||||
* @param ExceptionEventArgs $eventArgs An ExceptionEventArgs instance
|
||||
*/
|
||||
public function onCoreException(ExceptionEventArgs $eventArgs)
|
||||
{
|
||||
@ -60,7 +60,7 @@ class ProfilerListener
|
||||
/**
|
||||
* Handles the filterCoreResponse event.
|
||||
*
|
||||
* @param EventInterface $eventArgs An EventInterface instance
|
||||
* @param FilterResponseEventArgs $eventArgs A FilterResponseEventArgs instance
|
||||
*/
|
||||
public function filterCoreResponse(FilterResponseEventArgs $eventArgs)
|
||||
{
|
||||
|
@ -90,10 +90,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="loader" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="engine" type="templating_engine" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="assets-base-url" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="assets-version" type="xsd:string" />
|
||||
<xsd:attribute name="assets-base-urls" type="xsd:string" />
|
||||
<xsd:attribute name="cache" type="xsd:string" />
|
||||
<xsd:attribute name="cache-warmer" type="cache_warmer" />
|
||||
</xsd:complexType>
|
||||
|
@ -86,15 +86,20 @@ build: 56
|
||||
{
|
||||
font-size:12px;
|
||||
color:#868686;
|
||||
padding-bottom:10px;
|
||||
padding: 5px 4px;
|
||||
list-style-type:decimal;
|
||||
margin-left:24px;
|
||||
margin-left:20px;
|
||||
}
|
||||
|
||||
/* fix for Opera not liking empty <li> */
|
||||
.sf-exceptionreset .traces li:after {
|
||||
content: '\00A0'
|
||||
}
|
||||
|
||||
.sf-exceptionreset #logs .traces em
|
||||
{
|
||||
font-style:normal;
|
||||
color:#aacd4e;
|
||||
color:#AA3333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@ -259,5 +264,4 @@ build: 56
|
||||
.sf-exceptionreset li .selected
|
||||
{
|
||||
background-color: #ffd;
|
||||
padding: 4px 3px
|
||||
}
|
||||
|
@ -93,6 +93,11 @@ img
|
||||
color:#565656;
|
||||
}
|
||||
|
||||
.search input[type="search"]
|
||||
{
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
|
||||
button
|
||||
{
|
||||
-webkit-appearance: button-bevel;
|
||||
|
@ -4,127 +4,127 @@
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être fausse</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être vraie</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être de type {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être vide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être l'un des choix proposés</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target></target>
|
||||
<target>Vous devez sélectionner au moins {{ limit }} choix</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target></target>
|
||||
<target>Vous devez sélectionner au maximum {{ limit }} choix</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target></target>
|
||||
<target>Les champs {{ fields }} n'ont pas été prévu</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target></target>
|
||||
<target>Les champs {{ fields }} sont manquants</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas une date valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas une date valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas une adresse email valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target></target>
|
||||
<target>Le fichier n'as pas été trouvé</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target></target>
|
||||
<target>Le fichier n'est pas lisible</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target></target>
|
||||
<target>Le fichier est trop lourd ({{ size }}). La taille maximale autorisée est {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target></target>
|
||||
<target>Le type du fichier est invalide ({{ type }}). Les types autorisés sont {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être {{ limit }} ou moins</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target></target>
|
||||
<target>Cette chaine est trop longue. Elle doit avoir {{ limit }} caractères au maximum</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être {{ limit }} ou plus</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target></target>
|
||||
<target>Cette chaine est trop courte. Elle doit avoir {{ limit }} caractères au minimum</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target></target>
|
||||
<target>Cette valeur ne doit pas être vide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target></target>
|
||||
<target>Cette valeur ne doit pas être nulle</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être nulle</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas une heure valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target></target>
|
||||
<target>Cette valeur n'est pas une URL valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target></target>
|
||||
<target>Cette valeur doit être une instance de la classe {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target></target>
|
||||
<target>Ce groupe de champs ne doit pas contenir des champs supplémentaires</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target></target>
|
||||
<target>Le fichier envoyé est trop gros. Merci d'essayer d'envoyer un fichier plus petit</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target></target>
|
||||
<target>Le jeton CSRF est invalide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target></target>
|
||||
<target>Les deux valeurs doivent être égales</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Deve essere falso</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Deve essere vero</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Deve essere di tipo {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Deve essere vuoto</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Deve essere una delle opzioni disponibili</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Selezionare almeno {{ limit }} opzioni</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Selezionare al massino {{ limit }} opzioni</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>{{ fields }} non valido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>{{ fields }} mancanti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Data non valida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Data e ora non valide</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Email non valida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>File non trovato</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>File non leggibile</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>File troppo grande ({{ size }}). La dimensione massima consentita è di {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>Il mime type del file non è valido ({{ type }}). I tipi permessi sono {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Deve essere {{ limit }} o meno</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Troppo grande. Può essere lungo {{ limit }} caratteri o meno</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Deve essere {{ limit }} caratteri o più</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Il valore inserito è troppo corto. Deve essere lungo {{ limit }} caratteri o più</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Non può essere vuoto</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Non può essere null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Deve essere null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Non valido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Ora non valida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>URL non valido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Deve essere istanza della classe {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>Questo gruppo di campi non deve contenete nessun campo extra</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Il file è troppo grande. Fare l'upload di un file più piccolo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>Il token CSRF non è valido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>I due valori devono essere uguali</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Deze waarde zou niet waar moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Deze waarde zou waar moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Deze waarde zou van het type {{ type }} moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Deze waarde zou leeg moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Deze waarde zou een van de gegeven opties moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Selecteer tenminste {{ limit }} opties</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Selecteer maximaal {{ limit }} opties</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>De velden {{ fields }} werden niet verwacht</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>De velden {{ fields }} ontbreken</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Deze waarde is geen geldige datum</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Deze waarde is geen geldige datum/tijd</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Deze waarde is geen geldig e-mailadres</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>Het bestand is niet gevonden</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>Het bestand niet leesbaar</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>Het bestand is te groot({{ size }}). Toegestane maximum grootte is {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>Het mime type van het bestand is ongeldig ({{ type }}). Toegestane mime types zijn {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Deze waarde zou {{ limit }} of minder moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Deze waarde is te lang. Het zou {{ limit }} karakters of minder moeten hebben</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Deze waarde zou {{ limit }} of meer moeten zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Deze waarde is te kort. Het zou {{ limit }} karakters of meer moeten hebben</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Deze waarde mag niet leeg zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Deze waarde mag niet null zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Deze waarde moet null zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Deze waarde is ongeldig</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Deze waarde is geen geldige tijd </target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Deze waarde is geen geldige URL</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Deze waarde moet een instantie van de klasse {{ class }} zijn</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>Deze veld groep mag geen extra velden bevatten</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Het geüploade bestand is te groot. Probeer een kleiner bestand te uploaden</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>Het CSRF token is ongeldig</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>De twee waarden moeten gelijk zijn</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -24,7 +24,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Powinieneś wybrać co najmniej {{ limit }} opcji</target>
|
||||
<target>Powinieneś wybrać co najmniej {{ limit }} opcji</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
@ -32,11 +32,11 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>Pola {{ fields }} były nieoczekiwane</target>
|
||||
<target>Pola {{ fields }} nie były oczekiwane</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>Brakowało pól {{ fields }}</target>
|
||||
<target>Brakuje pól {{ fields }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
@ -52,7 +52,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>Nie można było znaleźć pliku</target>
|
||||
<target>Plik nie mógł zostać odnaleziony</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
@ -60,35 +60,35 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>Plik jest zbyt wielki {{ size }}. Maksymalny dozwolony rozmiar to {{ limit }}</target>
|
||||
<target>Plik jest za duży ({{ size }}). Maksymalny dozwolony rozmiar to {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>Nieprawdidłowy typ mime pliku {{ type }}. Dozwolone typy mime to {{ types }}</target>
|
||||
<target>Nieprawdidłowy typ mime pliku ({{ type }}). Dozwolone typy mime to {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Ta wartośc powinna być {{ limit }} lub mniejsza</target>
|
||||
<target>Ta wartość powinna wynosić {{ limit }} lub mniej</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Ta wartość jest zbyt długa. Powinna mieć {{ limit }} znaków lub mniej</target>
|
||||
<target>Ta wartość jest zbyt długa. Powinna mieć {{ limit }} lub mniej znaków</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Ta wartość powinna być {{ limit }} lub większa</target>
|
||||
<target>Ta wartość powinna wynosić {{ limit }} lub więcej</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} znaków lub więcej</target>
|
||||
<target>Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub więcej znaków</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Ta wartość nie może być pusta</target>
|
||||
<target>Ta wartość nie powinna być pusta</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Ta wartość nie może być nullem</target>
|
||||
<target>Ta wartość nie powinna być nullem</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
@ -104,7 +104,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Ta wartość nie jest prawidłowym URLem</target>
|
||||
<target>Ta wartość nie jest prawidłowym URL-em</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
@ -116,7 +116,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Wgrany plik był zbyt wielki. Proszę spróbować wgrać mniejszy plik</target>
|
||||
<target>Wgrany plik był za duży. Proszę spróbować wgrać mniejszy plik</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
@ -124,7 +124,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>Dwie wartości powinny być równe</target>
|
||||
<target>Obie wartości powinny być równe</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Este valor deveria ser falso</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Este valor deveria ser verdadeiro</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Este valor deveria ser do tipo {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Este valor deveria ser vazio</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Este valor deveria ser um das opções exibidas</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Você deveria selecionar {{ limit }} opções no mínimo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Você deveria selecionar {{ limit }} opções no máximo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>Os campos {{ fields }} não eram esperados</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>Os campos {{ fields }} estão ausentes</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Este valor não é uma data válida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Este valor não é uma data e hora válida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Este valor não é um endereço de e-mail válido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>O arquivo não pode ser encontrado</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>O arquivo não pode ser lido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>O arquivo é muito grande ({{ size }}). O tamanho máximo permitido é {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>O tipo mime do arquivo é inválido ({{ type }}). Os tipos mime permitidos são {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Este valor deveria ser {{ limit }} ou menos</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>O valor é muito longo. Deveria ter {{ limit }} caracteres ou menos</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Este valor deveria ser {{ limit }} ou mais</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>O valor é muito curto. Deveria ter {{ limit }} caracteres ou mais</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Este valor não deveria ser vazio</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Este valor não deveria ser nulo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Este valor deveria ser nulo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Este valor não é válido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Este valor não é uma hora válida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Este valor não é uma URL válida</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Este valor deveria ser uma instância da classe {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>Este grupo de campos não deveria conter campos adicionais</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>O arquivo enviado é muito grande. Por favor, tente enviar um arquivo menor</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>O token CSRF é inválido</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>Os dois valores deveriam ser iguais</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Значение должно быть ложным</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Значение должно быть точным</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Значение должно быть типа {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Значение должно быть пустым</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Значение должно быть одним из предложенных</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Выберите минимум {{ limit }} возможностей</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Выберите максимум {{ limit }} возможностей</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>Поля {{ fields }} не ожидались</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>Поля {{ fields }} осутствуют</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Значение даты недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Значение даты и времени недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Значение адреса электронной почты недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>Файл не может быть найден</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>Файл не может быть прочитан</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>Файл слишком большой ({{ size }}). Максимальный допустимый размер {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>MIME-тип файла недопустим ({{ type }}). Допустимы MIME-типы файлов {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Значение должно быть {{ limit }} или меньше</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Значение слишком длинное. Должно быть {{ limit }} символов или меньше</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Значение должно быть {{ limit }} или больше</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Значение слишком короткое. Должно быть {{ limit }} символов или больше</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Значение не должно быть пустым</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Значение не должно быть null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Значение должно быть null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Значение недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Значение времени недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Значение URL недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Значение должно быть экземпляром класса {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>Эта группа полей не должна иметь дополнительных полей</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Загружённый файл слишком большой. Пожалуйста, попробуйте загрузить файл меньше</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>CSRF значение недопустимо</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>Оба значения должны быть одинаковыми</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Vrednost bi morala biti nepravilna (false)</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Vrednost bi morala biti pravilna (true)</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Vrednost mora biti naslednjega tipa {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Vrednost mora biti prazna</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Vrednost naj bo ena izmed podanih možnosti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Izberite vsaj {{ limit }} možnosti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Izberete lahko največ {{ limit }} možnosti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>Naslednja polja {{ fields }} niso bila pričakovana</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>Naslednja polja {{ fields }} ne obstajajo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Vrednost ne vsebuje veljavnega datuma</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Vrednost ne vsebuje veljavnega datuma in časa</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Vpisana vrednost ni veljaven email naslov</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>Datoteke ni mogoče najti</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>Datoteke ni mogoče prebrati</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>Datoteka je prevelika ({{ size }}). Največja dovoljena velikost je {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>Napačna Mime vrednost datoteke ({{ type }}). Dovoljene mime vrednosti so {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Vrednost mora biti manjša od {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Vpisana vrednost je predolga. Največja dolžina je {{ limit }} znakov</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Vpisana vrednost naj vsebuje vsaj {{ limit }} znakov</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Vpisana vrednost je prekratka. Vpišite vsaj {{ limit }} znakov</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Vrednost ne sme biti prazna</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Vrednost ne sme biti nedefinirana (null)</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Vrednost mora biti nedefinirana (null)</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Vrednost ni pravilna</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Vrednost ne vsebuje veljavnega časa</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Vrednost ne vsebuje veljavnega URL naslova</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Vrednost bi morala biti instanca razreda {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>To področje ne sme vsebovati dodatnih polj</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Naložena datoteka je prevelika. Prosim, poizkusite naložiti manjšo</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>CSRF vrednost je napačna</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>Vrednosti morata biti enaki</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0"?>
|
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<file source-language="en" datatype="plaintext" original="file.ext">
|
||||
<body>
|
||||
<trans-unit id="1">
|
||||
<source>This value should be false</source>
|
||||
<target>Вредност треба да буде нетачна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>This value should be true</source>
|
||||
<target>Вредност треба да буде тачна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>This value should be of type {{ type }}</source>
|
||||
<target>Вредност треба да буде типа {{ type }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>This value should be blank</source>
|
||||
<target>Вредност треба да буде празна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>This value should be one of the given choices</source>
|
||||
<target>Вредност треба да буде једна од понуђених</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="6">
|
||||
<source>You should select at least {{ limit }} choices</source>
|
||||
<target>Изаберите бар {{ limit }} могућности</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="7">
|
||||
<source>You should select at most {{ limit }} choices</source>
|
||||
<target>Изаберите највише {{ limit }} могућности</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>The fields {{ fields }} were not expected</source>
|
||||
<target>Поља {{ fields }} нису била очекивана</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>The fields {{ fields }} are missing</source>
|
||||
<target>Поља {{ fields }} недостају</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="10">
|
||||
<source>This value is not a valid date</source>
|
||||
<target>Вредност није валидан датум</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>This value is not a valid datetime</source>
|
||||
<target>Вредност није валидан датум-време</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>This value is not a valid email address</source>
|
||||
<target>Вредност није валидна адреса електронске поште</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="13">
|
||||
<source>The file could not be found</source>
|
||||
<target>Датотека не може бити пронађена</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>The file is not readable</source>
|
||||
<target>Датотека није читљива</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>The file is too large ({{ size }}). Allowed maximum size is {{ limit }}</source>
|
||||
<target>Датотека је превелика ({{ size }}). Највећа дозвољена величина је {{ limit }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}</source>
|
||||
<target>Миме тип датотеке није валидан ({{ type }}). Дозвољени миме типови су {{ types }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="17">
|
||||
<source>This value should be {{ limit }} or less</source>
|
||||
<target>Вредност треба да буде {{ limit }} или мање</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="18">
|
||||
<source>This value is too long. It should have {{ limit }} characters or less</source>
|
||||
<target>Вредност је предугачка. Треба да има {{ limit }} карактера или мање</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="19">
|
||||
<source>This value should be {{ limit }} or more</source>
|
||||
<target>Вредност треба да буде {{ limit }} или више</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="20">
|
||||
<source>This value is too short. It should have {{ limit }} characters or more</source>
|
||||
<target>Вредност је прекратка. Треба да има {{ limit }} карактера или више</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="21">
|
||||
<source>This value should not be blank</source>
|
||||
<target>Вредност не треба да буде празна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="22">
|
||||
<source>This value should not be null</source>
|
||||
<target>Вредност не треба да буде null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="23">
|
||||
<source>This value should be null</source>
|
||||
<target>Вредност треба да буде null</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="24">
|
||||
<source>This value is not valid</source>
|
||||
<target>Вредност је невалидна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="25">
|
||||
<source>This value is not a valid time</source>
|
||||
<target>Вредност није валидно време</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="26">
|
||||
<source>This value is not a valid URL</source>
|
||||
<target>Вредност није валидан URL</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="27">
|
||||
<source>This value should be instance of class {{ class }}</source>
|
||||
<target>Вредност треба да буде инстанца класе {{ class }}</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="28">
|
||||
<source>This field group should not contain extra fields</source>
|
||||
<target>Група поља не треба да садржи додатна поља</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="29">
|
||||
<source>The uploaded file was too large. Please try to upload a smaller file</source>
|
||||
<target>Отпремљена датотека је била превелика. Молим покушајте отпремање мање датотеке</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid</source>
|
||||
<target>CSRF вредност је невалидна</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="31">
|
||||
<source>The two values should be equal</source>
|
||||
<target>Обе вредности треба да буду једнаке</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -51,8 +51,8 @@
|
||||
<h2>
|
||||
Logs
|
||||
<a href="#" onclick="toggle('logs'); switchIcons('icon_logs_open', 'icon_logs_close'); return false;">
|
||||
<img class="toggle" id="icon_logs_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: hidden" />
|
||||
<img class="toggle" id="icon_logs_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: display; margin-left: -18px" />
|
||||
<img class="toggle" id="icon_logs_open" alt="+" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}" style="visibility: hidden" />
|
||||
<img class="toggle" id="icon_logs_close" alt="-" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}" style="visibility: display; margin-left: -18px" />
|
||||
</a>
|
||||
</h2>
|
||||
{% endspaceless %}
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="logs" style="display: none">
|
||||
<div id="logs">
|
||||
{% include 'FrameworkBundle:Exception:logs.html.twig' with { 'logs': logger.logs } only %}
|
||||
</div>
|
||||
|
||||
@ -96,25 +96,27 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function toggle(id, clazz) {
|
||||
el = document.getElementById(id);
|
||||
current = el.style.display
|
||||
var el = document.getElementById(id),
|
||||
current = el.style.display,
|
||||
i;
|
||||
|
||||
if (clazz) {
|
||||
var tags = document.getElementsByTagName('*');
|
||||
for (i = 0; i < tags.length; i++) {
|
||||
if (tags[i].className == clazz) {
|
||||
for (i = tags.length - 1; i >= 0 ; i--) {
|
||||
if (tags[i].className === clazz) {
|
||||
tags[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
el.style.display = current == 'none' ? 'block' : 'none';
|
||||
el.style.display = current === 'none' ? 'block' : 'none';
|
||||
}
|
||||
|
||||
function switchIcons(id1, id2) {
|
||||
var icon1, icon2, visibility1, visibility2;
|
||||
|
||||
icon1 = document.getElementById(id1);
|
||||
icon2 = document.getElementById(id2);
|
||||
|
||||
@ -124,6 +126,4 @@
|
||||
icon1.style.visibility = visibility2;
|
||||
icon2.style.visibility = visibility1;
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
//]]></script>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<img src="{{ asset('bundles/framework/images/grey_magnifier.png') }}" alt="Search on Symfony website" />
|
||||
</label>
|
||||
|
||||
<input name="q" id="search_id" type="text" placeholder="Search on Symfony website" />
|
||||
<input name="q" id="search_id" type="search" placeholder="Search on Symfony website" />
|
||||
|
||||
<button type="submit">
|
||||
<span class="border_l">
|
||||
|
@ -61,6 +61,11 @@ class SessionHelper extends Helper
|
||||
return $this->session->getFlash($name, $default);
|
||||
}
|
||||
|
||||
public function getFlashes()
|
||||
{
|
||||
return $this->session->getFlashes();
|
||||
}
|
||||
|
||||
public function hasFlash($name)
|
||||
{
|
||||
return $this->session->hasFlash($name);
|
||||
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
|
||||
|
||||
class ProfilerPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Tests that collectors that specify a template but no "id" will throw
|
||||
* an exception (both are needed if the template is specified). Thus,
|
||||
* a fully-valid tag looks something like this:
|
||||
*
|
||||
* <tag name="data_collector" template="YourBundle:Collector:templatename" id="your_collector_name" />
|
||||
*/
|
||||
public function testTemplateNoIdThrowsException()
|
||||
{
|
||||
// one service, with a template key, but no id
|
||||
$services = array(
|
||||
'my_collector_service' => array(0 => array('template' => 'foo')),
|
||||
);
|
||||
|
||||
$builder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$builder->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->returnValue($services));
|
||||
|
||||
$this->setExpectedException('InvalidArgumentException');
|
||||
|
||||
$profilerPass = new ProfilerPass();
|
||||
$profilerPass->process($builder);
|
||||
}
|
||||
|
||||
public function testValidCollector()
|
||||
{
|
||||
// one service, with a template key, but no id
|
||||
$services = array(
|
||||
'my_collector_service' => array(0 => array('template' => 'foo', 'id' => 'my_collector')),
|
||||
);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
->will($this->returnValue($services));
|
||||
|
||||
// fake the getDefinition() to return a Profiler definition
|
||||
$definition = new Definition('ProfilerClass');
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('getDefinition')
|
||||
->will($this->returnValue($definition));
|
||||
|
||||
// assert that the data_collector.templates parameter should be set
|
||||
$container->expects($this->once())
|
||||
->method('setParameter')
|
||||
->with('data_collector.templates', array('my_collector_service' => array('my_collector', 'foo')));
|
||||
|
||||
$profilerPass = new ProfilerPass();
|
||||
$profilerPass->process($container);
|
||||
|
||||
// grab the method calls off of the "profiler" definition
|
||||
$methodCalls = $definition->getMethodCalls();
|
||||
$this->assertEquals(1, count($methodCalls));
|
||||
$this->assertEquals('add', $methodCalls[0][0]); // grab the method part of the first call
|
||||
}
|
||||
}
|
@ -12,11 +12,12 @@
|
||||
<app:profiler only-exceptions="true" />
|
||||
<app:router cache-warmer="true" resource="%kernel.root_dir%/config/routing.xml" type="xml" />
|
||||
<app:session auto-start="true" class="Session" default-locale="fr" storage-id="native" name="_SYMFONY" lifetime="86400" path="/" domain="example.com" secure="true" httponly="true" />
|
||||
<app:templating assets-version="SomeVersionScheme" assets-base-urls="http://cdn.example.com" cache-warmer="true">
|
||||
<app:templating assets-version="SomeVersionScheme" cache-warmer="true">
|
||||
<app:loader>loader.foo</app:loader>
|
||||
<app:loader>loader.bar</app:loader>
|
||||
<app:engine id="php" />
|
||||
<app:engine id="twig" />
|
||||
<app:assets-base-url>http://cdn.example.com</app:assets-base-url>
|
||||
</app:templating>
|
||||
<app:translator enabled="true" fallback="fr" />
|
||||
<app:validation enabled="true" />
|
||||
|
@ -75,7 +75,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertTrue($container->getDefinition('session')->hasMethodCall('start'));
|
||||
$this->assertEquals('Session', $container->getParameter('session.class'));
|
||||
$this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage'));
|
||||
|
||||
|
||||
$options = $container->getParameter('session.storage.native.options');
|
||||
$this->assertEquals('_SYMFONY', $options['name']);
|
||||
$this->assertEquals(86400, $options['lifetime']);
|
||||
@ -103,7 +103,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
|
||||
$this->assertTrue($container->hasDefinition('templating.name_parser'), '->registerTemplatingConfiguration() loads templating.xml');
|
||||
$this->assertEquals('SomeVersionScheme', $container->getParameter('templating.assets.version'));
|
||||
$this->assertEquals('http://cdn.example.com', $container->getParameter('templating.assets.base_urls'));
|
||||
$this->assertEquals(array('http://cdn.example.com'), $container->getParameter('templating.assets.base_urls'));
|
||||
|
||||
$this->assertTrue($container->getDefinition('templating.cache_warmer.template_paths')->hasTag('kernel.cache_warmer'), '->registerTemplatingConfiguration() tags templating cache warmer if cache warming is set');
|
||||
$this->assertEquals('templating.locator.cached', (string) $container->getAlias('templating.locator'), '->registerTemplatingConfiguration() changes templating.locator alias to cached if cache warming is set');
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user