mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-08 12:32:42 +00:00
Consolidate with conditions sniff.
This commit is contained in:
parent
11981f80fa
commit
e1c128bb99
25 changed files with 41 additions and 83 deletions
|
@ -834,9 +834,7 @@ class DboSource extends DataSource {
|
|||
$matches[1] . '(' . $this->name($matches[2]) . ')'
|
||||
);
|
||||
}
|
||||
if (
|
||||
preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches
|
||||
)) {
|
||||
if (preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches)) {
|
||||
return $this->cacheMethod(
|
||||
__FUNCTION__, $cacheKey,
|
||||
preg_replace(
|
||||
|
@ -1313,8 +1311,7 @@ class DboSource extends DataSource {
|
|||
$assocResultSet = array();
|
||||
$prefetched = false;
|
||||
|
||||
if (
|
||||
($type === 'hasOne' || $type === 'belongsTo') &&
|
||||
if (($type === 'hasOne' || $type === 'belongsTo') &&
|
||||
isset($row[$LinkModel->alias], $joined[$Model->alias]) &&
|
||||
in_array($LinkModel->alias, $joined[$Model->alias])
|
||||
) {
|
||||
|
@ -1337,8 +1334,7 @@ class DboSource extends DataSource {
|
|||
foreach ($LinkModel->{$type1} as $assoc1 => $assocData1) {
|
||||
$DeepModel = $LinkModel->{$assoc1};
|
||||
|
||||
if (
|
||||
$type1 === 'belongsTo' ||
|
||||
if ($type1 === 'belongsTo' ||
|
||||
($type === 'belongsTo' && $DeepModel->alias === $modelAlias) ||
|
||||
($DeepModel->alias !== $modelAlias)
|
||||
) {
|
||||
|
@ -1589,8 +1585,7 @@ class DboSource extends DataSource {
|
|||
$assocFields = $this->fields($Model, null, "{$Model->alias}.{$Model->primaryKey}");
|
||||
$passedFields = $queryData['fields'];
|
||||
|
||||
if (
|
||||
count($passedFields) > 1 ||
|
||||
if (count($passedFields) > 1 ||
|
||||
(strpos($passedFields[0], $assocFields[0]) === false && !preg_match('/^[a-z]+\(/i', $passedFields[0]))
|
||||
) {
|
||||
$queryData['fields'] = array_merge($passedFields, $assocFields);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue