Find condition in cakePHP with Containable behavior

mattpyongyang

New Member
I have 2 models, User and Evolution. User has many Evolution, Evolution belongs to User.I have 10 000 users and I want to do a condition that give me 500 users that DON'T have today's date in the Evolution table.Originally, I was taking every one in the USER table and then I was looking if they had their row in Evolution like:\[code\]$user=$this->User->find('all',array('contain' => array( 'Evolution' => array('conditions' => array('date'=>$lastupdate)) ), 'fields' => array( 'name', 'id', ) ));\[/code\]and then looking if there was a row or not :\[code\]if(empty($user['Evolution'])) {\[/code\]But I think that is farely stupid to take 10 000 users and foreach them all to just take 500.How can I do my find to directly have 500 users that DO NOT have today's date in Evolution table.Thanks!!
 
Back
Top