CakePHP 3 find list with valuefield as lowercase -


    $this->find('list', [         'keyfield' => 'id',         'valuefield' => 'lower(code)',         'conditions' => ['service_id' => $service_id],         'hydrate' => false     ])->toarray(); 

i need select value table lowercase, when apply code above, returns empty values like:

array(    '1' =>     '2' =>     '3' =>  ) 

i not want use virtual fields. there missing?

i tried way below, not desired result.

'valuefield' => function($e){     return $e->get('lower(code)'); } 

maybe looking :

$this->find('list', [     'keyfield' => 'id',      //set code field lowercase     'valuefield' => function($q){ return strtolower($q->code); },      'conditions' => ['service_id' => $service_id],     'hydrate' => false ])->toarray(); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -