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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -