diff --git a/UPDATE.md b/UPDATE.md index 8438a79bec..1b6de71d83 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -6,6 +6,28 @@ one. It only discusses changes that need to be done when using the "public" API of the framework. If you "hack" the core, you should probably follow the timeline closely anyway. +beta2 to beta3 +-------------- + +* The settings under "framework.annotations" have changed slightly: + + Before: + + framework: + annotations: + cache: file + file_cache: + debug: true + dir: /foo + + After: + + framework: + annotations: + cache: file + debug: true + file_cache_dir: /foo + beta1 to beta2 -------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index be7f1c8774..39232b2f8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -274,13 +274,8 @@ class Configuration implements ConfigurationInterface ->addDefaultsIfNotSet() ->children() ->scalarNode('cache')->defaultValue('file')->end() - ->arrayNode('file_cache') - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('dir')->defaultValue('%kernel.cache_dir%/annotations')->end() - ->booleanNode('debug')->defaultValue($this->debug)->end() - ->end() - ->end() + ->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end() + ->booleanNode('debug')->defaultValue($this->debug)->end() ->end() ->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 8cf6523ec1..a5e448b046 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -517,23 +517,24 @@ class FrameworkExtension extends Extension $loader->load('annotations.xml'); if ('file' === $config['cache']) { - $cacheDir = $container->getParameterBag()->resolveValue($config['file_cache']['dir']); + $cacheDir = $container->getParameterBag()->resolveValue($config['file_cache_dir']); if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true)) { throw new \RuntimeException(sprintf('Could not create cache directory "%s".', $cacheDir)); } $container - ->getDefinition('annotations.cache.file_cache') - ->replaceArgument(0, $cacheDir) - ->replaceArgument(1, $config['file_cache']['debug']) + ->getDefinition('annotations.file_cache_reader') + ->replaceArgument(1, $cacheDir) + ->replaceArgument(2, $config['debug']) ; - } else if ('none' === $config['cache']) { - $container->setAlias('annotation_reader', 'annotations.reader'); - } else { + $container->setAlias('annotation_reader', 'annotations.file_cache_reader'); + } else if('none' !== $config['cache']) { $container ->getDefinition('annotations.cached_reader') ->replaceArgument(1, new Reference($config['cache'])) + ->replaceArgument(2, $config['debug']) ; + $container->setAlias('annotation_reader', 'annotations.cached_reader'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml index c708aab609..c278057a96 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml @@ -5,25 +5,26 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - Doctrine\Common\Annotations\Cache\FileCache - Doctrine\Common\Annotations\AnnotationReader Doctrine\Common\Annotations\CachedReader + Doctrine\Common\Annotations\FileCacheReader - - - - - - + + + + + + + + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 7ec9243e7f..161ad66907 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -128,15 +128,8 @@ - - - - - - - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index c33b312338..f0c448098d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -59,9 +59,7 @@ $container->loadFromExtension('framework', array( ), 'annotations' => array( 'cache' => 'file', - 'file_cache' => array( - 'dir' => '%kernel.cache_dir%/annotations', - 'debug' => true, - ) + 'debug' => true, + 'file_cache_dir' => '%kernel.cache_dir%/annotations', ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index 78fe6a4dac..8d85dc77fa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -31,8 +31,6 @@ - - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index a33b33e15e..5e8cde5855 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -45,6 +45,5 @@ framework: cache: apc annotations: cache: file - file_cache: - dir: %kernel.cache_dir%/annotations - debug: true + debug: true + file_cache_dir: %kernel.cache_dir%/annotations diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index f154e38562..63d9c24b7d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -172,8 +172,8 @@ abstract class FrameworkExtensionTest extends TestCase { $container = $this->createContainerFromFile('full'); - $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.cache.file_cache')->getArgument(0)); - $this->assertEquals('annotations.cached_reader', (string) $container->getAlias('annotation_reader')); + $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.file_cache_reader')->getArgument(1)); + $this->assertInstanceOf('Doctrine\Common\Annotations\FileCacheReader', $container->get('annotation_reader')); } public function testValidationAnnotations()