title: How to get Doctrine to work inside a helper function on Symfony2
body: <p>I need to get doctrine working inside my helper, im trying to use like i normaly do in a controller:</p>
  
  <pre><code>$giftRepository = $this-&gt;getDoctrine( )-&gt;getRepository( 'DonePunctisBundle:Gift' );
  </code></pre>
  
  <p>But this gave me: </p>
  
  <blockquote>
    <p>FATAL ERROR: CALL TO UNDEFINED METHOD
    DONE\PUNCTISBUNDLE\HELPER\UTILITYHELPER::GETDOCTRINE() IN
    /VAR/WWW/VHOSTS/PUNCTIS.COM/HTTPDOCS/SRC/DONE/PUNCTISBUNDLE/HELPER/UTILITYHELPER.PH</p>
  </blockquote>
  
  <p>What Im missing here?</p>
  
  <p>EDIT: </p>
  
  <p><strong>services file</strong></p>
  
  <pre><code>services:
      templating.helper.utility:
          class: Done\PunctisBundle\Helper\UtilityHelper
          arguments: [@service_container]
          tags:
              - { name: templating.helper, alias: utility }
  </code></pre>
  
  <p>Firts lines of helper file</p>
  
  <pre><code>&lt;?php
  namespace Done\PunctisBundle\Helper;
  
  use Symfony\Component\Templating\Helper\Helper;
  use Symfony\Component\Templating\EngineInterface;
  
  
  
  class UtilityHelper extends Helper {
  
      /*
       * Dependency injection
       */
  
      private $container;
  
      public function __construct( $container )
      {
          $this-&gt;container = $container;
      }
  </code></pre>