我如何使用类元数据?

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 C:\wamp\www\OxiaOpm\app\cache\dev\appDevDebugProjectContainer.php on line 3673 and defined in C:\wamp\www\OxiaOpm\vendor\doctrine\orm\lib\Doctrine\ORM\EntityRepository.php line 68

Any help plz

This is my UserRepository.php

<?php

namespace Oxia\UserBundle\Entity;

use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
#use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NoResultException;


class UserRepository extends EntityRepository implements UserProviderInterface
{
    public function loadUserByUsername($username)
    {
        $q = $this
            ->createQueryBuilder('u')
            ->where('u.username = :username OR u.email = :email')
            ->setParameter('username', $username)
            ->setParameter('email', $username)
            ->getQuery();

        try {
            // La méthode Query::getSingleResult() lance une exception
            // s'il n'y a pas d'entrée correspondante aux critères
            $user = $q->getSingleResult();
        } catch (NoResultException $e) {
            throw new UsernameNotFoundException(sprintf('Unable to find an active admin     AcmeUserBundle:User object identified by "%s".', $username), 0, $e);
        }

        return $user;
    }

    public function refreshUser(UserInterface $user)
    {
        $class = get_class($user);
        if (!$this->supportsClass($class)) {
            throw new UnsupportedUserException(
                sprintf(
                    'Instances of "%s" are not supported.',
                    $class
                )
            );
        }

        return $this->find($user->getId());
    }

    public function supportsClass($class)
    {
        return $this->getEntityName() === $class || is_subclass_of($class, $this->getEntityName());
    }
}

This is my services.yml:

parameters:
    webservice_user_provider.class: Oxia\UserBundle\Entity\UserRepository

services:
    oxia_project.security.my_password_encoder:
        class: Oxia\UserBundle\Security\Encoder\AdminPasswordEncoder

    webservice_user_provider:
        class: %webservice_user_provider.class%
        arguments: [@doctrine.orm.entity_manager]

Construction of an entity repository should be handled by the entity manager. I assume that by configuring your repository as a service you were doing it manually. You can use a factory for constructing your service:

services.yml

my_user_provider:
    class: Oxia\UserBundle\Entity\UserRepository
    factory_service: doctrine.orm.entity_manager
    factory_method: getRepository
    arguments: [Oxia\UserBundle\Entity\User]

For Symfony >= 2.7 you should use the following style (the factory_* configuration keys are deprecated):

my_user_provider:
    class: Oxia\UserBundle\Entity\UserRepository
    factory:
        - "@doctrine.orm.entity_manager"
        - getRepository
    arguments: [Oxia\UserBundle\Entity\User]