Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Forward plugin reset params in controller #166

@GeeH

Description

@GeeH

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7685
User: @popovsergiy
Created On: 2016-03-13T00:50:21Z
Updated At: 2016-03-15T20:33:52Z
Body
I build interface which can render content in tabs and separately by url. I use for this forward plugin in controller and after second call params return null for all

public function indexAction() {
    $params = $this->plugin('params');

    $productsGridVm = $this->forward()->dispatch(
        $params->fromRoute('controller'), // here controller is 'store'
        ['action' => 'products']
    );
    $orderGridVm = $this->forward()->dispatch(
        $params->fromRoute('controller'), // here controller is 'null'
        ['action' => 'orders']
    );

    $view = (new ViewModel())
        ->setTemplate('tab/switcher')
        ->addChild($productsGridVm, 'products')
        ->addChild($orderGridVm, 'orders');

    return $view;
}

but if use RouteMatch object all works as expected

public function indexAction() {
    $route = $this->getEvent()->getRouteMatch();

    $productsGridVm = $this->forward()->dispatch(
        $route->getParam('controller'), 
        ['action' => 'products']
    );
    $orderGridVm = $this->forward()->dispatch(
        $route->getParam('controller'), 
        ['action' => 'orders']
    );

    $view = (new ViewModel())
        ->setTemplate('tab/switcher')
        ->addChild($productsGridVm, 'products')
        ->addChild($orderGridVm, 'orders');

    return $view;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions