I have a query to get a username from the entity with date:
return $this->createQueryBuilder('t')
->select('t.username')
->where('t.date = :date')
->andWhere('t.username = :username')
->setParameter('date', $date)
->setParameter('username', $username)
->getQuery()
;
However, when I want to find a username in the array, I use this:
if (in_array($user_array, $username) != true) {
I get this $username
array:
array(1) {
[0] =>
array(1) {
'username' =>
string(9) "username1"
}
}
array(1) {
[0] =>
array(1) {
'username' =>
string(10) "username90"
}
}
array(1) {
[0] =>
array(1) {
'username' =>
string(10) "username12"
}
}
Is it even possible to search if the username is within the array? Do I need to adjust my QueryBuilder code or do I need to resort to another solution in Symfony?