Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added classes to cache #197

Closed
wants to merge 3 commits into from

3 participants

@dlsniper

Hello,

This commit adds some used classes to Symfony2 cache.
See the talk in sensiolabs/SensioDistributionBundle#76

Let me know if it needs anything else/if I've did it against the wrong branch (it should go into 2.2 distro).

Thanks.

@dlsniper

When will this be merged? ping :)

@fabpot
Owner

We should add the classes only if we are sure that they will be used. So, they should be added only when the related configuration setting is enabled.

@dlsniper

I think this should be a little bit better now.

DependencyInjection/SensioFrameworkExtraExtension.php
((30 lines not shown))
}
if ($config['cache']['annotations']) {
$annotationsToLoad[] = 'cache.xml';
+
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\CacheListener',
+ ));
+ }
+
+ if (empty($annotationsToLoad)) {
+ return ;
@fabpot Owner
fabpot added a note

Can you avoid the early return as it looks inconsistent with the other conditions. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fabpot fabpot commented on the diff
DependencyInjection/SensioFrameworkExtraExtension.php
@@ -35,28 +35,56 @@ public function load(array $configs, ContainerBuilder $container)
if ($config['router']['annotations']) {
$annotationsToLoad[] = 'routing.xml';
+
@fabpot Owner
fabpot added a note

extra blank line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fabpot fabpot referenced this pull request from a commit
@fabpot fabpot merged branch dlsniper/classes-cache (PR #197)
This PR was squashed before being merged into the master branch (closes #197).

Commits
-------

23daf05 Added classes to cache

Discussion
----------

Added classes to cache

Hello,

This commit adds some used classes to Symfony2 cache.
 See the talk in sensiolabs/SensioDistributionBundle#76

Let me know if it needs anything else/if I've did it against the wrong branch (it should go into 2.2 distro).

Thanks.

---------------------------------------------------------------------------

by dlsniper at 2013-02-28T07:43:38Z

When will this be merged? ping :)

---------------------------------------------------------------------------

by fabpot at 2013-02-28T07:56:06Z

We should add the classes only if we are sure that they will be used. So, they should be added only when the related configuration setting is enabled.

---------------------------------------------------------------------------

by dlsniper at 2013-02-28T12:43:05Z

I think this should be a little bit better now.
50cfef6
@fabpot fabpot closed this pull request from a commit
@fabpot fabpot merged branch dlsniper/classes-cache (PR #197)
This PR was squashed before being merged into the master branch (closes #197).

Commits
-------

23daf05 Added classes to cache

Discussion
----------

Added classes to cache

Hello,

This commit adds some used classes to Symfony2 cache.
 See the talk in sensiolabs/SensioDistributionBundle#76

Let me know if it needs anything else/if I've did it against the wrong branch (it should go into 2.2 distro).

Thanks.

---------------------------------------------------------------------------

by dlsniper at 2013-02-28T07:43:38Z

When will this be merged? ping :)

---------------------------------------------------------------------------

by fabpot at 2013-02-28T07:56:06Z

We should add the classes only if we are sure that they will be used. So, they should be added only when the related configuration setting is enabled.

---------------------------------------------------------------------------

by dlsniper at 2013-02-28T12:43:05Z

I think this should be a little bit better now.
50cfef6
@fabpot fabpot closed this in 50cfef6
@apfelbox

There is an issue with this commit:
when the classes are added to the cache, the comment is omitted. And therefore the (required) @Annotation annotation.

This frequently throws errors when developing in the dev environment (works fine in prod).

[Semantical Error] The class "Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the class doc comment of "Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter". If it is indeed no annotation, then you need to add @IgnoreAnnotation("ParamConverter") to the class doc comment of method ...Controller::editAction().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2013
  1. @dlsniper

    Added classes to cache

    dlsniper authored
Commits on Feb 28, 2013
  1. @dlsniper
  2. @dlsniper

    Fixed as per GH feedback

    dlsniper authored
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 0 deletions.
  1. +25 −0 DependencyInjection/SensioFrameworkExtraExtension.php
View
25 DependencyInjection/SensioFrameworkExtraExtension.php
@@ -35,18 +35,39 @@ public function load(array $configs, ContainerBuilder $container)
if ($config['router']['annotations']) {
$annotationsToLoad[] = 'routing.xml';
+
@fabpot Owner
fabpot added a note

extra blank line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ControllerListener',
+ ));
}
if ($config['request']['converters']) {
$annotationsToLoad[] = 'converters.xml';
+
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter',
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ParamConverterListener',
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\DateTimeParamConverter',
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\DoctrineParamConverter',
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface',
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterManager',
+ ));
}
if ($config['view']['annotations']) {
$annotationsToLoad[] = 'view.xml';
+
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\TemplateListener',
+ ));
}
if ($config['cache']['annotations']) {
$annotationsToLoad[] = 'cache.xml';
+
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\CacheListener',
+ ));
}
if ($annotationsToLoad) {
@@ -56,6 +77,10 @@ public function load(array $configs, ContainerBuilder $container)
foreach ($annotationsToLoad as $config) {
$loader->load($config);
}
+
+ $this->addClassesToCompile(array(
+ 'Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ConfigurationAnnotation',
+ ));
}
}
Something went wrong with that request. Please try again.