php - How to access a different controller from inside a controller Symfony2 -
i need access method different controller inside controller. how can it? can use this->get
method?
can include controller inside current controller , make object of , access method via object? "ok" way?
i want call form method --- newaction of other controller.
you can define controller service, in controller.
in services.yml
define needed controller service:
services: your_service_name: class: yourcompany\yourbundle\controller\yourcontroller
then in controller you'll able service via container:
$yourcontroller = $this->get('your_service_name');
there useful information controllers services in documentation
Comments
Post a Comment