Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doctrine findby magic null value

I'm wondering if there is anyway to use doctrine's magic method to look for null values. For instance:

Doctrine::getTable('myClass')->findByDeletedAt(null);

Essentially, I want to return all records that are not deleted. I've tried the above, but it doesn't seem to work.

Any ideas?

like image 675
Sean Avatar asked Dec 17 '22 21:12

Sean


1 Answers

Trying this gives me the error:

Catchable fatal error: Argument 1 passed to Doctrine\ORM\EntityRepository::findBy() must be an array, string given

So this works for me:

$repository->findBy(array('date_field' => null));
like image 94
Daniel W. Avatar answered Dec 30 '22 18:12

Daniel W.