The ContainerBuilder has a method to remove a service by id. so you can rewrite 
the service you want to change.

something I am not sure is the loading order of each bundle's DI.


On 15 nov. 2010, at 15:54, Florian wrote:

> Ok, it seems we can't access other Extensions services during
> configLoad.
> 
> I will try with this solution: https://gist.github.com/700426
> 
> On 13 nov, 18:48, Florian <[email protected]> wrote:
>> Hi,
>> 
>> Is it possible to define method calls on an already defined service ?
>> 
>> Example: I have the DoctrineExtenstion that set the
>> "doctrine.dbal.default_connection.event_manager" service definintion.
>> 
>> I want to add method calls on the definition from antoher bundle dic
>> extension ( aka DoctrineExtensionsExtension)
>> 
>> So what I wrote is this:
>> 
>>     public function configLoad($config, ContainerBuilder $container)
>>     {
>>         $loader = new XmlFileLoader($container, __DIR__.'/../Resources/
>> config');
>>         $loader->load('doctrine_extensions.xml');
>>         if(array_key_exists('orm.listener.sluggable', $config))
>>         {
>>             
>> $container->getDefinition('doctrine.dbal.default_connection.event_manager')
>> 
>>                 ->addMethodCall('addEventSubscriber', 
>> array($container->getParameter('doctrine_extensions.orm.listener.sluggable')));
>> 
>>         }
>>     }
>> 
>> The problem is that the $container throws an excpetion: 'The service
>> definition "doctrine.dbal.default_connection.event_manager" does not
>> exist.'
>> 
>> var_dump($container->getDefinitions()) returns an empty array.
>> 
>> Do you have any idea ?
>> 
>> Here is my config:
>> 
>> doctrine_extensions.config:
>>   orm.listener.sluggable: ~
>> 
>> doctrine.dbal:
>>   connections:
>>     default:
>>       dbname:                       symfony2_ecommerce
>>       user:                            root
>>       password:                     ~
>> 
>> Thanks,
>> Florian.
> 
> -- 
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
> 
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to