Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Smarter default for framework.annotations#20749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:3.2fromogizanagi:fix/fwk_bundle/annotation_defaults
Dec 14, 2016
Merged

[FrameworkBundle] Smarter default for framework.annotations#20749

fabpot merged 1 commit intosymfony:3.2fromogizanagi:fix/fwk_bundle/annotation_defaults
Dec 14, 2016

Conversation

@ogizanagi
Copy link
Contributor

QA
Branch?3.2
Bug fix?yesish (could be considered as a minor BC break)
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

framework.annotations default should be true only ifdoctrine/annotations is installed.

Indeed, in#20097, the dependency ondoctrine/annotations was removed from the framework bundle.
Thus, an application can break (not talking from one actually relying on annotations) as soon as it uses the framework bundle without theframework.annotations key explicitly set tofalse (I had the case in a fixture application in the testsuite of a package).

linaori, theofidry, and chalasr reacted with thumbs up emoji
->info('annotation configuration')
->canBeDisabled()
->children()
->booleanNode('enabled')->defaultValue(class_exists('Doctrine\Common\Annotations\Annotation'))->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You can useAnnotation::class here.

@dunglas
Copy link
Member

dunglas commentedDec 5, 2016
edited
Loading

👍 (travis error not related)

@nicolas-grekasnicolas-grekas added this to the3.2 milestoneDec 6, 2016
->children()
->arrayNode('annotations')
->info('annotation configuration')
->canBeDisabled()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should be removed I think

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No, I can't because I still need the logic insidecanBeDisabled but I'm simply overriding the boolean node and its default value.

However, if it seems less "hacky", I can replace the fix by:

diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.phpindex 4b9af8c..4a7dfa2 100644--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php@@ -603,9 +603,8 @@ class Configuration implements ConfigurationInterface             ->children()                 ->arrayNode('annotations')                     ->info('annotation configuration')-                    ->canBeDisabled()+                    ->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}()                     ->children()-                        ->booleanNode('enabled')->defaultValue(class_exists(Annotation::class))->end()                         ->scalarNode('cache')->defaultValue('php_array')->end()                         ->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()                         ->booleanNode('debug')->defaultValue($this->debug)->end()

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hum...The two codes slightly differ. With the patch above:

    annotations:        cache: php_array

will properly enable annotations whereas the current implementation doesn't (which is wrong).

So I'll apply the patch.

@chalasr
Copy link
Member

chalasr commentedDec 7, 2016
edited
Loading

👍 Upgrading was hard for me too on LexikJWTAuthenticationBundle which requires the framework in 2.8+ and don't make use of annotations at all, tests was broken on 3.2.

Symfony\Component\DependencyInjection\Exception\LogicException: Annotations cannot be enabled as the Doctrine Annotation library is not installed

Status: reviewed

@ogizanagi
Copy link
ContributorAuthor

@fabpot What do you think about this one?

It'll be great to have it for 3.2.2 IMHO.

@stof
Copy link
Member

this indeed makes sense

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot merged commite38be09 intosymfony:3.2Dec 14, 2016
fabpot added a commit that referenced this pull requestDec 14, 2016
…s (ogizanagi)This PR was merged into the 3.2 branch.Discussion----------[FrameworkBundle] Smarter default for framework.annotations| Q             | A| ------------- | ---| Branch?       | 3.2| Bug fix?      | yesish (could be considered as a minor BC break)| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        | N/A`framework.annotations` default should be true only if `doctrine/annotations` is installed.Indeed, in#20097, the dependency on `doctrine/annotations` was removed from the framework bundle.Thus, an application can break (not talking from one actually relying on annotations) as soon as it uses the framework bundle without the `framework.annotations` key explicitly set to `false` (I had the case in a fixture application in the testsuite of a package).Commits-------e38be09 [FrameworkBundle] framework.annotations default should be true only if doctrine/annotations is installed
@ogizanagiogizanagi deleted the fix/fwk_bundle/annotation_defaults branchDecember 14, 2016 08:15
@fabpotfabpot mentioned this pull requestJan 12, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas left review comments

@chalasrchalasrchalasr left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.2

Development

Successfully merging this pull request may close these issues.

7 participants

@ogizanagi@dunglas@chalasr@stof@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp