Answer the question
In order to leave comments, you need to log in
How to call another controller from zf2 controller and get its template?
For example, we have an IndexController:
<?php
namespace ZfcIndex\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction() {
return nev ViewModel();
}
}
$controller = $this->serviceManager->get('ZfcLogin\Factory\Controller\UserControlleFactoryr');
$class = $controller->{'indexAction'}();
Answer the question
In order to leave comments, you need to log in
Found the answer:
return $this->forward()->dispatch('Controller', array('action' => 'action'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question