Answer the question
In order to leave comments, you need to log in
Symfony2 how to pass a container from a controller?
Can't pass container to controller
//...
use Symfony\Component\DependencyInjection\ContainerInterface;
class TestController extends Controller
{
protected $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
}
parameters:
# ...
test.class: Test\TestBundle\Controller\TestController
services:
test:
class: "%test.class%"
arguments: ["@service_container"]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question