And then in the where I don’t know how to place it as the CONCAT returns a function expression so I can’t simply do [$concat . ' LIKE' => '%inputString%]. I tried the like() function but wasn’t successful either:
->where('OR' => [$concat->like($concat => '%inputString%')]) // Illegal array key type
Can someone point me to the place where this is documented in here?
If it is not there, I really feel that such things should be present in the documentation. I found answers to this question for the laravel query builder but not cakephp so I’d be very grateful for some help.
Note, I’m only using the database module from the cake framework (not the ORM).
And my preferred solution would be without the need for the $query instance at all like
Thank you for the answer, Kevin.
Is there a way to use this concat outside the ->where() function ?
I’m building the where array outside the repository class that makes the request. toArray() does not work for me: Method 'toArray' not found in \Cake\Database\Query .
If I do
Argument #2 ($query) must be of type Cake\Database\Query,
Cake\Database\Expression\QueryExpression given, called in
\vendor\cakephp\database\Expression\QueryExpression.php on line 719