0

I have an array property inside my entity which contains series of dates in 'd/m/Y' format.

I'm trying to write a query which will select all instances of entity which don't have some date passed as argument to repository method in that array property.

I tried with:

 ->andWhere(
      $qb->expr()->notLike('u.datesBooked', ':date')
 )

and

 ->andWhere(
      $qb->expr()->notIn($date->format('d/m/Y'), 'u.datesBooked')
 )

with no luck, i get the wrong results. Is this even possible on database level?

1
  • See: stackoverflow.com/a/39229713/1791606 . You would need to use ->where('u.datesBooked like :datesBooked')->setParameter('datesBooked', '%'.$date->format('d/m/Y').'%'). Commented Sep 27, 2016 at 14:18

1 Answer 1

0

Try:

->andWhere('u.datesBooked != :date')
->setParameter('date', $date);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.