Reputation: 7
I have a DI problem in symfony2 controller
public function __construct(EngineInterface $engine,EntityManager $entityManager,...
config
acme.acme_controller:
class: %acme.acme_controller_class%
arguments:
- @templating
- @doctrine.orm.entity_manager
...
calls:
- [ setContainer, [ @service_container ] ]
basicly this works if I display a page in browser, but it breaks if I try to use
$this->forward("Acme:Acme:something", array('id' => $id));
All I get is
Argument 1 passed to ::__construct() must implement interface Symfony\Component\Templating\EngineInterface, none given, called in app\cache\dev\classes.php on line 1543 and defined
Redirects works fine so what am I doing wrong here? Symfony 2.3.11
Upvotes: 0
Views: 85
Reputation: 48865
You need to pass the service id (as opposed the the bundle class name) to get DI to kick in. Something like:
$this->forward("acme.acme_controller:somethingAction", array('id' => $id));
Edited to add Action per the comment.
Upvotes: 1