title: Context Help for EWZ_SEARCH bundle Symfony Jobeet 2.3 to 2.8 upgrade
body: <p>A while back I completed this series of tutorials and converted the jobeet from symfony 1 to symfony 2.</p>
  
  <p><a href="http://intelligentbee.com/blog/2013/08/07/symfony2-jobeet-day-1-starting-up-the-project/" rel="nofollow">http://intelligentbee.com/blog/2013/08/07/symfony2-jobeet-day-1-starting-up-the-project/</a></p>
  
  <p>I am now trying to upgrade it to 2.8</p>
  
  <p>Everything works except for the lucene search.</p>
  
  <p>I am attempting to implement EWZSearchBundle as a solution.</p>
  
  <p>config.yml</p>
  
  <pre><code>ewz_search:
      indices:
          indexJob:
              path:                 %kernel.root_dir%/EwzLuceneIndices/%kernel.environment%/myIndexJob
              analyzer:             Zend\Search\Lucene\Analysis\Analyzer\Common\Utf8\CaseInsensitive
  
      # deprecated
      analyzer:             Zend\Search\Lucene\Analysis\Analyzer\Common\TextNum\CaseInsensitive
      path:                 %kernel.root_dir%/cache/%kernel.environment%/lucene/index        
  </code></pre>
  
  <p>search action in controller</p>
  
  <pre><code>public function searchAction(Request $request)
      {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $query = $this-&gt;getRequest()-&gt;get('query');
  
          if(!$query) {
              if(!$request-&gt;isXmlHttpRequest()) {
                  return $this-&gt;redirect($this-&gt;generateUrl('ibw_job'));
              } else {
                  return new Response('No results.');
              }
          }
  
          $jobs = $em-&gt;getRepository('AcmeJobeetBundle:Job')-&gt;getForLuceneQuery($query);
  
          if($request-&gt;isXmlHttpRequest()) {
              if('*' == $query || !$jobs || $query == '') {
                  return new Response('No results.');
              }
  
              return $this-&gt;render('AcmeJobeetBundle:Job:list.html.twig', array('jobs' =&gt; $jobs));
          }
  
      }
  </code></pre>
  
  <p>function in entity repository </p>
  
  <pre><code> static public function getLuceneIndex()
      {
         $luceneSearchForFooIndex = $this-&gt;get('ewz_search.lucene.manager')-&gt;getIndex('indexJob');
  
          return $luceneSearchForFooIndex ;
      }
  </code></pre>
  
  <p>The error that I get in app_dev.php</p>
  
  <pre><code> Error: Using $this when not in object context
  500 Internal Server Error - FatalErrorException 
  </code></pre>
  
  <p>I know that "$this" is out of context and that is why I am getting the error but I have absolutely no id on how to fix it.</p>
  
  <p>Any help/links to docs/ideas for a solution is greatly appreciated.</p>
  
  <p>Thanks in advance.</p>