Created
August 25, 2012 20:53
-
-
Save Ph3nol/3470847 to your computer and use it in GitHub Desktop.
Symfony DiC: register new Definition
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
<?php | |
use Symfony\Component\DependencyInjection\DefinitionDecorator; | |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | |
use Symfony\Component\DependencyInjection\Reference; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
// ... | |
$exampleDef = new DefinitionDecorator('coo_example.service_name'); | |
$exampleDef | |
->addArgument(new Reference('doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE)) | |
->addTag('doctrine.event_subscriber') | |
; | |
$container->setDefinition('coo_example.service_name.test', $exampleDef); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment