php - Zend Framework 2 get identity in view helper -
php - Zend Framework 2 get identity in view helper -
i need display user cart amount on each page of e-shop application.
to accomplish that, have created view helper don't know how user's identity ...
<?php namespace ...; utilize ...\services\traits\ordersservicestrait; utilize zend\view\helper\abstracthelper; class cartamount extends abstracthelper { utilize ordersservicetrait; public function __invoke() { // needs identity here ... $amount = $this->getordersservice()->fetchcartamount($user); if (!$amount) homecoming 0; homecoming $amount; } } appreciate help
normally dependency injection illustration needed here, in case, $this->view->identity() (calling identity view helper) should give you're after.
php zend-framework2
Comments
Post a Comment