mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Update query building in TranslateBehavior.
* Reduce duplicate checks for Alias.*. * Allow both the quoted and non quoted version of Alias.* Fixes #3210
This commit is contained in:
parent
6818d69fc3
commit
0fc9a2c29c
1 changed files with 5 additions and 2 deletions
|
@ -147,11 +147,14 @@ class TranslateBehavior extends ModelBehavior {
|
|||
if (empty($query['fields'])) {
|
||||
$addFields = $fields;
|
||||
} elseif (is_array($query['fields'])) {
|
||||
$isAllFields = (
|
||||
in_array($Model->alias . '.' . '*', $query['fields']) ||
|
||||
in_array($Model->escapeField('*'), $query['fields'])
|
||||
);
|
||||
foreach ($fields as $key => $value) {
|
||||
$field = (is_numeric($key)) ? $value : $key;
|
||||
|
||||
if (
|
||||
in_array($Model->escapeField('*'), $query['fields']) ||
|
||||
$isAllFields ||
|
||||
in_array($Model->alias . '.' . $field, $query['fields']) ||
|
||||
in_array($field, $query['fields'])
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue