-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Moved and updated the tags article from cookbook to components section #1398
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
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ecbef63
Moved and edited the tags article to fit it into the component section
richardmiller-zz fdaf8bb
Added cookbook on differences whne using compiler passes in the frame…
richardmiller-zz 359ffd9
Updated the map to reflect changes
richardmiller-zz 83636b7
Clarified that it is container builders that can work with tags
richardmiller-zz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
introduction | ||
definitions | ||
compilation | ||
tags | ||
factories | ||
parentservices | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
How to work with Compiler Passes in Bundles | ||
=========================================== | ||
|
||
Compiler passes give you an opportunity to manipulate other service | ||
definitions that have been registered with the service container. You | ||
can read about how to create them in the components section ":doc:`/components/dependency_injection/compilation`". | ||
To register a compiler pass from a bundle you need to add it to the build | ||
method of the bundle definition class:: | ||
|
||
namespace Acme\MailerBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
use Acme\MailerBundle\DependencyInjection\Compiler\CustomCompilerPass; | ||
|
||
class AcmeMailerBundle extends Bundle | ||
{ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
parent::build($container); | ||
|
||
$container->addCompilerPass(new CustomCompilerPass()); | ||
} | ||
} | ||
|
||
One of the common tasks for compiler passes is to work with tagged services, | ||
read more about this in the components section ":doc:`/components/dependency_injection/tags`". | ||
If you are using custom tags in a bundle then by convention, tag names consist | ||
of the name of the bundle (lowercase, underscores as separators), followed | ||
by a dot, and finally the "real" name, so the tag "transport" in the AcmeMailerBundle | ||
should be: ``acme_mailer.transport``. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ Service Container | |
|
||
event_listener | ||
scopes | ||
tags | ||
compiler_passes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only the ContainerBuilder, not the Container