[DoctrineBundle] fixed CS

This commit is contained in:
Fabien Potencier 2011-04-27 09:47:35 +02:00
parent aab56fa91e
commit 631393e29d
2 changed files with 36 additions and 38 deletions

View File

@ -123,8 +123,7 @@ abstract class AbstractDoctrineExtension extends Extension
}
$this->drivers[$mappingConfig['type']][$mappingConfig['prefix']] = realpath($mappingConfig['dir']);
} else {
throw new \InvalidArgumentException("Invalid mapping path given. ".
"Cannot load mapping/bundle named '" . $mappingName . "'.");
throw new \InvalidArgumentException(sprintf('Invalid mapping path given. Cannot load mapping/bundle named "%s".', $mappingName));
}
}
@ -226,20 +225,19 @@ abstract class AbstractDoctrineExtension extends Extension
protected function assertValidMappingConfiguration(array $mappingConfig, $objectManagerName)
{
if (!$mappingConfig['type'] || !$mappingConfig['dir'] || !$mappingConfig['prefix']) {
throw new \InvalidArgumentException("Mapping definitions for manager '".$objectManagerName."' ".
"require at least the 'type', 'dir' and 'prefix' options.");
throw new \InvalidArgumentException(sprintf('Mapping definitions for manager "%s" require at least the "type", "dir" and "prefix" options.', $objectManagerName));
}
if (!file_exists($mappingConfig['dir'])) {
throw new \InvalidArgumentException("Specified non-existing directory '" . $mappingConfig['dir'] . "' as mapping source.");
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as mapping source.', $mappingConfig['dir']));
}
if (!in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
throw new \InvalidArgumentException("Can only configure 'xml', 'yml', 'annotation', 'php' or ".
"'staticphp' through the DoctrineBundle. Use your own bundle to configure other metadata drivers. " .
"You can register them by adding a a new driver to the ".
"'" . $this->getObjectManagerElementName($objectManagerName . ".metadata_driver")."' service definition."
);
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
'You can register them by adding a a new driver to the '.
'"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'.metadata_driver')
));
}
}

View File

@ -174,7 +174,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
$this->loadOrmEntityManagerMappingInformation($entityManager, $ormConfigDef, $container);
$this->loadOrmCacheDrivers($entityManager, $container);
$uniqueMethods = array(
$methods = array(
'setMetadataCacheImpl' => new Reference(sprintf('doctrine.orm.%s_metadata_cache', $entityManager['name'])),
'setQueryCacheImpl' => new Reference(sprintf('doctrine.orm.%s_query_cache', $entityManager['name'])),
'setResultCacheImpl' => new Reference(sprintf('doctrine.orm.%s_result_cache', $entityManager['name'])),
@ -184,7 +184,7 @@ class DoctrineExtension extends AbstractDoctrineExtension
'setAutoGenerateProxyClasses' => '%doctrine.orm.auto_generate_proxy_classes%',
'setClassMetadataFactoryName' => $entityManager['class_metadata_factory_name'],
);
foreach ($uniqueMethods as $method => $arg) {
foreach ($methods as $method => $arg) {
$ormConfigDef->addMethodCall($method, array($arg));
}