ZF-792: Components (Symfony-like defenition) in MVC


I didn't found in ZFW future like component is Symfony. I'm writen it.…

For more information see… (russian)

If you know more right way, notify me, please.


Assign to Matthew.

From reviewing the code, it looks like this is a Zend_View helper class designed to allow pulling in content from another controller action, and that it has some amount of caching included in the interface.

What I'm wondering is: why would you do this instead of using _forward() in the action controller? Can you give me some details on what prompted this particular design, and use cases?


That's right - this is a Zend_View helper. Some code for example

      require_once 'Zend/Controller/Action.php';
      class IndexController extends Zend_Controller_Action
      public function indexAction()
      $View = new Zend_View();
      $View->addHelperPath('../application/helpers/', 'Avlab_View_Helper_');
      echo $View->render('indexView.php');
      public function componentAction()
      echo "It's work!!!";
      public function noRouteAction()


There are 3 component call:
<?echo $this->loadComponent('index', 'component');?>
<?echo $this->loadComponent('index', 'component');?>
<?echo $this->loadComponent('index', 'component');?>

We don't need to controll call chain in controller by using _forward(). In other way we should notify next controller2 about what controller3 it must forward to and then notify controller 3 what controller4 must forward to etc. It very hard.

In other way we should modify _forward() to allow constructions like that:

$this->_forward('controller', 'component1');
$this->_forward('controller', 'component2');
$this->_forward('controller', 'component3');
// etc

it's means, that next action is 'component1' and after it will execute action component2 will start etc.

But it isn't right alternative. I can't say rightly why, because I have troubles in my english :) You may read symfony-book by this subject.

Please review the Zend_View_Helper_Action view helper in the incubator. This component will be available for the 1.1.0 release as part of the Zend_View Enhanced proposal, and accomplishes what you've outlined.

Action view helper merged to core.