updated to latest changes in Doctrine
This commit is contained in:
parent
5e1710f136
commit
9c0db88851
22
UPDATE.md
22
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
|
API of the framework. If you "hack" the core, you should probably follow the
|
||||||
timeline closely anyway.
|
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
|
beta1 to beta2
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@ -274,13 +274,8 @@ class Configuration implements ConfigurationInterface
|
|||||||
->addDefaultsIfNotSet()
|
->addDefaultsIfNotSet()
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('cache')->defaultValue('file')->end()
|
->scalarNode('cache')->defaultValue('file')->end()
|
||||||
->arrayNode('file_cache')
|
->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()
|
||||||
->addDefaultsIfNotSet()
|
->booleanNode('debug')->defaultValue($this->debug)->end()
|
||||||
->children()
|
|
||||||
->scalarNode('dir')->defaultValue('%kernel.cache_dir%/annotations')->end()
|
|
||||||
->booleanNode('debug')->defaultValue($this->debug)->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
@ -517,23 +517,24 @@ class FrameworkExtension extends Extension
|
|||||||
$loader->load('annotations.xml');
|
$loader->load('annotations.xml');
|
||||||
|
|
||||||
if ('file' === $config['cache']) {
|
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)) {
|
if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true)) {
|
||||||
throw new \RuntimeException(sprintf('Could not create cache directory "%s".', $cacheDir));
|
throw new \RuntimeException(sprintf('Could not create cache directory "%s".', $cacheDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
$container
|
$container
|
||||||
->getDefinition('annotations.cache.file_cache')
|
->getDefinition('annotations.file_cache_reader')
|
||||||
->replaceArgument(0, $cacheDir)
|
->replaceArgument(1, $cacheDir)
|
||||||
->replaceArgument(1, $config['file_cache']['debug'])
|
->replaceArgument(2, $config['debug'])
|
||||||
;
|
;
|
||||||
} else if ('none' === $config['cache']) {
|
$container->setAlias('annotation_reader', 'annotations.file_cache_reader');
|
||||||
$container->setAlias('annotation_reader', 'annotations.reader');
|
} else if('none' !== $config['cache']) {
|
||||||
} else {
|
|
||||||
$container
|
$container
|
||||||
->getDefinition('annotations.cached_reader')
|
->getDefinition('annotations.cached_reader')
|
||||||
->replaceArgument(1, new Reference($config['cache']))
|
->replaceArgument(1, new Reference($config['cache']))
|
||||||
|
->replaceArgument(2, $config['debug'])
|
||||||
;
|
;
|
||||||
|
$container->setAlias('annotation_reader', 'annotations.cached_reader');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,25 +5,26 @@
|
|||||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||||
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter key="annotations.cache.file_cache.class">Doctrine\Common\Annotations\Cache\FileCache</parameter>
|
|
||||||
|
|
||||||
<parameter key="annotations.reader.class">Doctrine\Common\Annotations\AnnotationReader</parameter>
|
<parameter key="annotations.reader.class">Doctrine\Common\Annotations\AnnotationReader</parameter>
|
||||||
<parameter key="annotations.cached_reader.class">Doctrine\Common\Annotations\CachedReader</parameter>
|
<parameter key="annotations.cached_reader.class">Doctrine\Common\Annotations\CachedReader</parameter>
|
||||||
|
<parameter key="annotations.file_cache_reader.class">Doctrine\Common\Annotations\FileCacheReader</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<services>
|
<services>
|
||||||
<service id="annotations.cache.file_cache" class="%annotations.cache.file_cache.class%" public="false">
|
|
||||||
<argument /><!-- Cache Directory -->
|
|
||||||
<argument /><!-- Debug-Flag -->
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="annotations.reader" class="%annotations.reader.class%" public="false" />
|
<service id="annotations.reader" class="%annotations.reader.class%" public="false" />
|
||||||
|
|
||||||
<service id="annotations.cached_reader" class="%annotations.cached_reader.class%" public="false">
|
<service id="annotations.cached_reader" class="%annotations.cached_reader.class%" public="false">
|
||||||
<argument type="service" id="annotations.reader" />
|
<argument type="service" id="annotations.reader" />
|
||||||
<argument type="service" id="annotations.cache.file_cache" />
|
<argument /><!-- Cache Implementation -->
|
||||||
|
<argument /><!-- Debug-Flag -->
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="annotations.file_cache_reader" class="%annotations.file_cache_reader.class%" public="false">
|
||||||
|
<argument type="service" id="annotations.reader" />
|
||||||
|
<argument /><!-- Cache-Directory -->
|
||||||
|
<argument /><!-- Debug Flag -->
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="annotation_reader" alias="annotations.cached_reader" />
|
<service id="annotation_reader" alias="annotations.reader" />
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -128,15 +128,8 @@
|
|||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="annotations">
|
<xsd:complexType name="annotations">
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="file-cache" type="annotations.file_cache" minOccurs="0" maxOccurs="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
|
|
||||||
<xsd:attribute name="cache" type="xsd:string" />
|
<xsd:attribute name="cache" type="xsd:string" />
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
<xsd:complexType name="annotations.file_cache">
|
|
||||||
<xsd:attribute name="dir" type="xsd:string" />
|
|
||||||
<xsd:attribute name="debug" type="xsd:string" />
|
<xsd:attribute name="debug" type="xsd:string" />
|
||||||
|
<xsd:attribute name="file-cache-dir" type="xsd:string" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
|
@ -59,9 +59,7 @@ $container->loadFromExtension('framework', array(
|
|||||||
),
|
),
|
||||||
'annotations' => array(
|
'annotations' => array(
|
||||||
'cache' => 'file',
|
'cache' => 'file',
|
||||||
'file_cache' => array(
|
'debug' => true,
|
||||||
'dir' => '%kernel.cache_dir%/annotations',
|
'file_cache_dir' => '%kernel.cache_dir%/annotations',
|
||||||
'debug' => true,
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
</framework:templating>
|
</framework:templating>
|
||||||
<framework:translator enabled="true" fallback="fr" />
|
<framework:translator enabled="true" fallback="fr" />
|
||||||
<framework:validation enabled="true" cache="apc" />
|
<framework:validation enabled="true" cache="apc" />
|
||||||
<framework:annotations cache="file">
|
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
|
||||||
<framework:file-cache dir="%kernel.cache_dir%/annotations" debug="true" />
|
|
||||||
</framework:annotations>
|
|
||||||
</framework:config>
|
</framework:config>
|
||||||
</container>
|
</container>
|
||||||
|
@ -45,6 +45,5 @@ framework:
|
|||||||
cache: apc
|
cache: apc
|
||||||
annotations:
|
annotations:
|
||||||
cache: file
|
cache: file
|
||||||
file_cache:
|
debug: true
|
||||||
dir: %kernel.cache_dir%/annotations
|
file_cache_dir: %kernel.cache_dir%/annotations
|
||||||
debug: true
|
|
||||||
|
@ -172,8 +172,8 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('full');
|
$container = $this->createContainerFromFile('full');
|
||||||
|
|
||||||
$this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.cache.file_cache')->getArgument(0));
|
$this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.file_cache_reader')->getArgument(1));
|
||||||
$this->assertEquals('annotations.cached_reader', (string) $container->getAlias('annotation_reader'));
|
$this->assertInstanceOf('Doctrine\Common\Annotations\FileCacheReader', $container->get('annotation_reader'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidationAnnotations()
|
public function testValidationAnnotations()
|
||||||
|
Reference in New Issue
Block a user