خرید بک لینک

Vote count: 0

I want to assign generic variables to the view renderer.

I'd prefer to handle this in the module class.

My question is, how do I create a view model in the module class that can be shared with the controller .

My end result is to have the ability to add variables to the view model before we create a new instance of one inside the controller action.

Here's something I started on, however i caot add variables to the declared viewmodel and have it persist to the controller's new instance of a view model.

Is there a way to create a view model and have it set as the renderer before dispatch.

    class BaseController extends AbstractActionController
    {
        protected $viewModel;

        public function onDispatch(MvcEvent $e)
        {       
            $this->viewModel = new ViewModel([
                'module' => 'modulename',
                'controller' => 'controllername',
                'action' => 'actioame'
            ]);         
            parent::onDispatch($e);
        }
    }

asked 16 secs ago

برچسب: create shared view mvc,clearcase create shared view,lotus notes create shared view, نویسنده: استخدام کار تاريخ: پنجشنبه 21 مرداد 1395 ساعت: 11:21

صفحه بندی