zend framework - Hacking the phprenderer, helpers throwing errors -


i have route use create caches updatepostcaches. making curl calls application, saving output, compressing it, , writing cache dir. problem is slow because has keep loading whole application on , on again. have used phprenderer in context, never required helpers such 'translate'.

    $this->renderer = new \zend\view\renderer\phprenderer();     $this->resolver = new \zend\view\resolver\templatemapresolver();     $this->renderer->setresolver($this->resolver);      $this->renderer->gethelperpluginmanager()->setservicelocator($servicelocator);      //this 1 did resolve error getting 'rootlocationjson', feel shouldn't have     $this->renderer->gethelperpluginmanager()->setfactory('rootlocationjson', \location\view\helper\locationfactory::class);      //even doesn't work     $this->renderer->gethelperpluginmanager()-> setfactory('translate', 'zend\i18n\view\helper\translate');      $this->rootlocations = $this->om->getrepository(\location\entity\location::class)->findby(array('parent' => null));      //also wish didn't have     $this->resolver->add(         array(             'layout' => realpath(__dir__ . '/../../../../application/view/layout/layout.phtml'),             'index' => realpath(__dir__ . '/../../../../cache/view/cache/index/index.phtml'),             'post' => realpath(__dir__ . '/../../../../cache/view/cache/index/post.phtml'),             'location' => realpath(__dir__ . '/../../../../cache/view/cache/index/location.phtml'),         )     );      $viewmodel = new \zend\view\model\viewmodel($vars);     $viewmodel->settemplate($view);      $layout = new \zend\view\model\viewmodel(array('content' => $this->renderer->render($viewmodel)));     $layout->settemplate('layout');       $output = $this->renderer->render($layout); 

after last line following error: zend\view\helperpluginmanager::get unable fetch or create instance 'translate'

i feel i'm doing wrong. suggested use currently-instantiated phprenderer poison because again, phprenderer of different request still need rendered.


Comments