title: set some view variable in controller constructer
body: <p>I have the following code in my zf2 controller:</p>
  
  <pre><code>&lt;?php
  namespace Accounting\Controller;
  
  use Zend\Mvc\Controller\ActionController,
  Zend\View\Model\ViewModel,
  Accounting\Model,
  Zend\Paginator,
  Accounting\Scripts\CMSTranslator;
  
  class AdminController extends ActionController {
  
  protected $translator;
  
  public function setTranslator(CMSTranslator $translator) {
      $this-&gt;translator = $translator;
      return $this;
  }
  
  public function __construct(\Doctrine\ORM\EntityManager $em,CMSTranslator $translator) {
      $this-&gt;em = $em;
  
      //$this-&gt;translator = new \Zend\Translator\Translator('ArrayAdapter', __DIR__ . '/../../../lang/lang-fa.php', 'fa');
      $this-&gt;translator = $translator;
  
      \Zend\Registry::set('tr', $this-&gt;translator);
      // now you can use the EntityManager!
  }
  </code></pre>
  
  <p>As you can see I'm using the zend\translator module.<br>
  I want to add it to the view in my controller constructor.
  I already tried:</p>
  
  <pre><code>return ViewModel(array('tr'=&gt;$translator));
  </code></pre>
  
  <p>But that doesn't work.</p>
  
  <p>Please help.</p>