1

The first thing that I do is to search all the users, and I successfully show all the users. Now I'm trying to query the roles of users, but it displays an array, like the image enter image description here

Do you have an idea on how to query this in symfony? or Is this allowed in symfony to query an array? I have no idea on how to do it. I try to search it to google but no result found. I'm just stuck on this query

$query =  $this->createQueryBuilder('u')
            ->where('u.role = :parameter')
            ->setParameter('parameter', 'ROLE_ADMIN')
            ->getQuery();

        return $query->getResult();

1 Answer 1

1

Replace = by like :

->where('u.role like :parameter')
->setParameter('parameter', '%ROLE_ADMIN%')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.