Skip to content

[Container][Tags] Added a note about _instanceof #9221

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

Closed
wants to merge 2 commits into from
Closed

[Container][Tags] Added a note about _instanceof #9221

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 7, 2018

Documentation related to symfony/symfony#21530 and symfony/symfony-docs issue #9089.

I was looking for this yesterday and couldn't find it, so I'm hereby updating the doc.

I was looking for this yesterday and couldn't find it, so I'm hereby updating the doc. This will also fix #9089.
@@ -82,6 +84,16 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you.
}
}

If you do not want to create a custom kernel, it is also possible to use `_instanceof`:

.. code-block:: yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the xml and php documentation format. However, I'm unsure of their notations at this point.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Note that for PHP, setInstanceofConditionals should be called for every single definition, since there is no "file" scope context there

@javiereguiluz javiereguiluz modified the milestones: 3.1, 3.4 Apr 19, 2018
@HeahDude
Copy link
Contributor

Hello @ghost! Thanks for working on this! Would you like to add the other config formats or should we take over your PR?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jul 1, 2018

I'd suggest adding a "tips" note stating something like:
While similar on the surface, registerForAuconfiguration() and instanceof-conditionals have different scope. registerForAuconfiguration() defines options that should be applied globally to all the definitions that have autoconfiguration enabled. Instanceof-conditionals apply only to the services defined in the very file where they are defined, whether or not these services have autoconfiguration enabled.

@javiereguiluz
Copy link
Member

This pull request stalled, so I've created #10491 to finish what reviewers asked here. Thanks!

javiereguiluz added a commit that referenced this pull request Oct 15, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

Improved the docs of the instanceof config

This finishes #9221.

Commits
-------

3d256c6 Improved the docs of the instanceof config
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.

7 participants