Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find() with an array as condition : Undefined offset: 1

Tags:

cakephp

My aim it to select lines in which etat_ce is one of the items in my array.

For some reason I can't find the right syntax in the cookbook for this kind of request.

$etat = array('livre', 'partiellement_livre', 'valide');
$out = $this->find('all', array('conditions' => array('etat_ce ' => $etat)));

When I do it this way, cake pops me a warning :

Notice (8): Undefined offset: 1 [CORE\Cake\Model\Datasource\DboSource.php, line 2549]

When I keep only one item in the array it works. Is is a problem with my syntax ?

EDIT: I use cake php ver 2.3.5 Many thanks !

like image 669
jmc Avatar asked May 07 '26 21:05

jmc


1 Answers

'etat_ce ' => remove the white space? Or try with the model name? 'Modelname.etat_ce'

like image 143
Aaron Avatar answered May 11 '26 15:05

Aaron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!