我正在尝试为从FOSUserbundle实现BaseClass的User类添加存储库类
/**
* @ORM\Table(name="mdm_user")
* @ORM\Entity(repositoryClass="AuthBundle\Repository\UserRepository")
*/
class User extends BaseUser
/**
* Class UserRepository
* @package AuthBundle\Repository
*/
class UserRepository extends EntityRepository implements UserProviderInterface但是当清除缓存时,我得到了错误:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: Missing argument 1 for Doctrine\ORM\EntityRepository::__construct(), called in /.../app/cache/de_/ap_DevDebugProjectContainer.php on line 385 and defined我正在尝试实现ApiKeyAuthenticator (from example in symfony documentation),但使用FOSUserBundle进行用户类管理和身份验证
更新
服务:
api_key_user_provider:
class: AuthBundle\Repository\UserRepository
apikey_authenticator:
class: AuthBundle\Security\ApiKeyAuthenticator
arguments: ["@api_key_user_provider"]发布于 2015-04-10 12:58:26
注意构造函数需要两个参数:$em (EntityManager)和$class (ClassMetadata)。因此,如果您想要创建一个自定义规则存储库作为服务,您应该像这样声明:
services:
acme_customer.customer_repository:
class: Doctrine\ORM\EntityRepository
factory_service: doctrine.orm.default_entity_manager
factory_method: getRepository
arguments:
- Acme\CustomerBundle\Entity\Customer有关更多信息,请查看此链接http://php-and-symfony.matthiasnoback.nl/2014/05/inject-a-repository-instead-of-an-entity-manager/
https://stackoverflow.com/questions/29520125
复制相似问题