title: Symfony2 : Argument 2 passed to Doctrine\ORM\EntityRepository::__construct() must be an instance of Doctrine\ORM\Mapping\ClassMetadata, none given
body: <p>I'm trying to implement OAuth2 in my actual symfony2 project using the FOSOAuthServerBundle.</p>
  
  <p>I've been following this <a href="http://blog.tankist.de/blog/2013/07/17/oauth2-explained-part-2-setting-up-oauth2-with-symfony2-using-fosoauthserverbundle/" rel="nofollow">Article</a> to implement it.</p>
  
  <p>Since i don't use FOS User bundle i had to create a UserProvider.</p>
  
  <p>I'm also using A User Repository as he did in his <a href="http://blog.tankist.de/blog/2013/07/17/oauth2-explained-part-2-setting-up-oauth2-with-symfony2-using-fosoauthserverbundle/" rel="nofollow">Article</a>.</p>
  
  <p>I've been stuck with this error :</p>
  
  <blockquote>
    <p>ContextErrorException: Catchable Fatal Error: Argument 2 passed to Doctrine\ORM\EntityRepository::__construct() must be an instance of Doctrine\ORM\Mapping\ClassMetadata, none given, called in /app/cache/dev/appDevDebugProjectContainer.php on line 3527 and defined in /app/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php line 67</p>
  </blockquote>
  
  <p>I've followed the given code for services.yml:</p>
  
  <p>And converted it to Yaml, here my file (services.yml) :</p>
  
  <pre><code>imports:
      - { resource: parameters.yml }
  
  parameters:
  #   wca_transition.example.class: WCA\TransitionBundle\Example
      collection.import.from_email: "%import_from_email%"
      collection.import.to_email: "%import_to_email%"
      platform.entity.user.class: WCA\ServerBundle\Entity\Profile
      platform.user.provider.class: WCA\ServerBundle\Provider\ProfileProvider
  
  services:
  #    wca_betosee_transition.example:
  #        class: %wca_transition.example.class%
  #        arguments: [@service_id, "plain_value", %parameter%]
  
      collectionImportCommand:
          class: WCA\ServerBundle\Command\CollectionImporterCommand
          calls:
          - [setContainer, ["@service_container"] ]
  
      platform.user.manager:
          class: Doctrine\ORM\EntityManager
          factory-service: doctrine
          factory-method: getManagerForClass
          arguments: ["%platform.entity.user.class%"]
  
      platform.user.repository:
          class: WCA\ServerBundle\Model\ProfileRepository
          factory-service: platform.user.manager
          factory-method: getRepository
          arguments: ["%platform.entity.user.class%"]
  
      platform.user.provider:
          class: "%platform.user.provider.class%"
          # arguments: ["@platform.user.repository"]
  
      platform.grant_type.api_key:
          class: WCA\ServerBundle\OAuth\ApiKeyGrantExtension
          arguments: ["@platform.user.repository"]
          tags:
              - { name: fos_oauth_server.grant_extension, uri: http://mywebsite.local/grants/api_key }
  </code></pre>
  
  <p>I suppose the given error is coming from my configuration but i don't see what could be wrong since i followed what was given. Either the services created don't get the given arguments ("none given") or i don't pass the correct ones.</p>
  
  <p>Any ideas or hints?</p>
  
  <p>PS : If you need any other files, don't hesitate to ask, i'll update the post. </p>