Reputation: 1747
I have a query in the model of my table:
$q = $this->createQuery('a')
->where('a.img1 = null')
->orderBy('a.created_at DESC')
->limit(4);
The thing is that it returns nothing, but in DB there is an entry with no image (img1 field is null). What am I doing wrong? thank you
Upvotes: 0
Views: 36
Reputation: 4588
$q = $this->createQuery('a')
->where('a.img1 IS NULL') // It needs to be IS NULL instead of = null
->orderBy('a.created_at DESC')
->limit(4);
Don't forget ->execute()
!
Upvotes: 1