title: Symfony2 Use parameters in EntityRepository
body: <p>I am wondering if this is even a good practice. But for my project i need to get a parameter from <code>parameters.yml</code> and use it inside <code>EntityRepository</code>.
  So for this I created a service but still the call is not executed.</p>
  
  <pre><code>services:
      xxx_repository:
          class: XXX\DatabaseBundle\Repository\CitiesRepository
          calls:
              - [setTheParameter, ["%the_parameter%"]]
  </code></pre>
  
  <blockquote>
    <p>parameters.yml</p>
  </blockquote>
  
  <pre><code>...
  the_parameter: 14400
  ...
  </code></pre>
  
  <p>And inside the CitiesRepository.php I am doing the following:</p>
  
  <pre><code>class CitiesRepository extends EntityRepository
  {
  
      /**
       * @var
       */
      protected $theParameter;
  
      public function setTheParameter($theParameter)
      {
          $this-&gt;theParameter = $theParameter;
      }
      ....
  }
  </code></pre>
  
  <p>But $this->theParameter is always null.</p>
  
  <p>SO i have 2 questions: Is this a healthy habit? And why is the result always null?</p>