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 [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-users?hl=en