我正在尝试创建一个自定义用户提供程序。
我将 my 定义UserProvider
为服务:
myvendor.user_provider:
class: MyVendor\UserBundle\Service\Security\UserProvider
这个类是一个DocumentRepository
:
namespace MyVendor\UserBundle\Service\Security;
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\ODM\MongoDB\DocumentRepository;
use Doctrine\ODM\MongoDB\DocumentNotFoundException;
class UserProvider extends DocumentRepository implements UserProviderInterface {
//public function loadUserBy...
}
但我得到这个错误:
Catchable Fatal Error: Argument 1 passed to Doctrine\ODM\MongoDB\DocumentRepository::__construct() must be an instance of Doctrine\ODM\MongoDB\DocumentManager, none given, called in /home/www/dev/public/myapp/app/cache/dev/appDevDebugProjectContainer.php on line 258 and defined in /home/www/dev/public/myapp/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentRepository.php line 68
似乎那时还没有创建文档管理器,因为我也尝试过注入它,但它抱怨它自己的依赖关系,比如UnitOfWork
.
我能做些什么?