That is definitely weird. Can you create a ticket?

Thanks,
Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

On 12/8/10 12:42 PM, benjamin.dulau wrote:
In fact, i think there is an issue here.

The xml driver for configuration does not seem to work well.

First of all, with the new PR4, the line :

<app:session default-locale="en" lifetime="3600" auto-start="true" />

Causes a crash of the application with a xsd validation error.


For the setter injection, when i use exactly the same configuration,
it works with YAML but not with XML.

For example, the YAML :
services:
     hello_controller:
         class: "Application\HelloBundle\Controller\HelloController"
         shared: true
         calls:
           - [ setTestService, [ @test_service ] ]
     test_service:
         class: "Application\HelloBundle\Service\Impl\TestService"

Works fine !

The equivalent XML :

     <services>
         <service id="hello_controller" class="Application\HelloBundle
\Controller\HelloController" shared="true">
             <call method="setTestService">
                 <argument type="service" id="test_service" />
             </call>
         </service>
         <service id="test_service" class="Application\HelloBundle
\Service\Impl\TestService" />
     </services>

Doesn't work, the setter method is not invoked.


cya,
Benjamin.


On 8 déc, 02:11, Marijn<marijn.huizendv...@gmail.com>  wrote:
Perhaps this article will help 
you:http://avalanche123.com/post/1215273326/symfony2-controller-testing

On Dec 7, 1:44 pm, "benjamin.dulau"<bd.web...@gmail.com>  wrote:







Hi,

Where can i find an example for setter injection in Symfony 2 please ?

I'm trying to do something like :

use Application\HelloBundle\Service;

class HelloController extends Controller
{
     /**
      * @var ITestService
      */
     private $testService;

     public function indexAction($name)
     {
         $test = $this->testService->say('Hey give me my service
instance !!');
         return $this->render('HelloBundle:Hello:index.twig',
array('name' =>  $name, 'test' =>  $test));
     }

     public function setTestService(ITestService $testService)
     {
         $this->testService = $testService;
         return $this;
     }

}

But i'm missing something, what should be the configuration for that ?

<services>
     <service id="hello_controller" class="Application\HelloBundle
\Controller\HelloController">
         <call method="setTestService">
             <argument type="service" id="service.test" />
         </call>
     </service>
     <service id="service.test" class="Application\HelloBundle\Service
\Impl\TestService" />
</services>

Thanks.

br,
Benjamin.


--
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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to