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

Issue Type: Patch Created: 2007-01-24T04:01:23.000+0000 Last Updated: 2008-03-21T16:25:14.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Roman Tolkachyov (rammstein) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: Attachments:


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.


Posted by Bill Karwin (bkarwin) on 2007-01-25T09:05:18.000+0000

Assign to Matthew.

Posted by Matthew Weier O'Phinney (matthew) on 2007-01-29T09:37:13.000+0000

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?


Posted by Roman Tolkachyov (rammstein) on 2007-01-29T11:09:32.000+0000

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

<pre class="highlight">
      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()


<pre class="highlight">
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:

<pre class="highlight">
$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.

Posted by Matthew Weier O'Phinney (matthew) on 2007-11-16T10:31:50.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2007-12-11T15:10:54.000+0000

Action view helper merged to core.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.