8000 Enhancing integration test to show that "override" tags show up first by weaverryan · Pull Request #22398 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Enhancing integration test to show that "override" tags show up first #22398

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2017

Conversation

weaverryan
Copy link
Member
Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR not needed

Relates a bit to #22396, in that I'm clarifying and emphasizing the following types of situations:

services:
    _instanceof:
        Symfony\Component\Security\Core\Authorization\Voter\VoterInterface:
            tags:
                # you probably shouldn't set priority here, but let's pretend we did
                - { name: security.voter, priority: 100 }

    AppBundle\Security\CoolPersonVoter:
        tags:
            - { name: security.voter, priority: 50 }

In the final Definition, the tags will appear in this order:

  • security.voter, priority 50
  • security.voter, priority 100

It works the same for parent-child definitions.

tl;dr; If a service has the same tag multiple times, the one that should be used should appear earlier in the Definition. The code already works that way - this test emphasizes it.

'bar_tag' => array(array()),
),
$simpleService->getTags()
$childDef2->getTags()
Copy link
Member Author

Choose a reason for hiding this comment

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

This was actually a typo/bug that I made originally. Fixed now

@nicolas-grekas
Copy link
Member

Thank you @weaverryan.

@nicolas-grekas nicolas-grekas merged commit e9b96e5 into symfony:master Apr 13, 2017
nicolas-grekas added a commit that referenced this pull request Apr 13, 2017
…show up first (weaverryan)

This PR was merged into the 3.3-dev branch.

Discussion
----------

Enhancing integration test to show that "override" tags show up first

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | not needed

Relates a bit to #22396, in that I'm clarifying and emphasizing the following types of situations:

```yml
services:
    _instanceof:
        Symfony\Component\Security\Core\Authorization\Voter\VoterInterface:
            tags:
                # you probably shouldn't set priority here, but let's pretend we did
                - { name: security.voter, priority: 100 }

    AppBundle\Security\CoolPersonVoter:
        tags:
            - { name: security.voter, priority: 50 }
```

In the final `Definition`, the tags will appear in this order:
* security.voter, priority 50
* security.voter, priority 100

It works the same for parent-child definitions.

tl;dr; If a service has the same tag multiple times, the one that should be used should appear *earlier* in the Definition. The code already works that way - this test emphasizes it.

Commits
-------

e9b96e5 Enhancing integration test to show that "override" tags always show up first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0