fix: [CRUD] Correct usage of the `like` condition operator on the query

pull/40/head
mokaddem 2021-03-10 09:37:22 +01:00
parent 9a1b38ff5a
commit 697c1ff0a6
1 changed files with 3 additions and 1 deletions

View File

@ -458,7 +458,9 @@ class CRUDComponent extends Component
if (strlen(trim($value, '%')) === strlen($value)) { if (strlen(trim($value, '%')) === strlen($value)) {
return $query->where([$fieldName => $value]); return $query->where([$fieldName => $value]);
} else { } else {
return $query->like([$fieldName => $value]); return $query->where(function ($exp, \Cake\ORM\Query $q) use ($fieldName, $value) {
return $exp->like($fieldName, $value);
});
} }
} }