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
Post a Comment