在实现安全UserInterface的Symfony2实体存储库中访问容器?

时间:2012-11-06 20:46:16

标签: symfony

我需要访问此特殊用户存储库中的容器。我不确定如何在不跳过UserProviderInterface的情况下执行此操作。谢谢你的帮助!

class UserRepository extends EntityRepository implements UserProviderInterface
{

    public function loadUserByUsername($username)
    {
        //the container provide the $tenantID, which I need for my query

        $q = $this
            ->createQueryBuilder('u')
            ->where('u.tenantid = :tenantid AND u.email = :email')
            ->setParameter('tenantid', $tenantId)
            ->setParameter('email', $username)
            ->getQuery();

        try {......

        return $user;
    }

0 个答案:

没有答案