mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Remove 'self' key from getConstraint() calculations because it is not necessary anymore.
This commit is contained in:
parent
e658e071d1
commit
014d2dd2d9
1 changed files with 6 additions and 6 deletions
|
@ -1320,7 +1320,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
|
||||
$selfJoin = ($LinkModel->name === $Model->name);
|
||||
$selfJoin = ($Model->name === $LinkModel->name);
|
||||
|
||||
if (!empty($fetch) && is_array($fetch)) {
|
||||
if ($recursive > 0) {
|
||||
|
@ -1605,14 +1605,14 @@ class DboSource extends DataSource {
|
|||
switch ($type) {
|
||||
case 'hasOne':
|
||||
case 'belongsTo':
|
||||
$self = ($Model->name === $linkModel->name);
|
||||
|
||||
$conditions = $this->_mergeConditions(
|
||||
$assocData['conditions'],
|
||||
$this->getConstraint($type, $Model, $linkModel, $association, array_merge($assocData, compact('external', 'self')))
|
||||
$this->getConstraint($type, $Model, $linkModel, $association, array_merge($assocData, compact('external')))
|
||||
);
|
||||
|
||||
if (!$self && $external) {
|
||||
$selfJoin = ($Model->name === $linkModel->name);
|
||||
|
||||
if ($external && !$selfJoin) {
|
||||
$modelAlias = $Model->alias;
|
||||
foreach ($conditions as $key => $condition) {
|
||||
if (is_numeric($key) && strpos($condition, $modelAlias . '.') !== false) {
|
||||
|
@ -1733,7 +1733,7 @@ class DboSource extends DataSource {
|
|||
* @return array Conditions array defining the constraint between $model and $association
|
||||
*/
|
||||
public function getConstraint($type, $model, $linkModel, $alias, $assoc, $alias2 = null) {
|
||||
$assoc += array('external' => false, 'self' => false);
|
||||
$assoc += array('external' => false);
|
||||
|
||||
if (empty($assoc['foreignKey'])) {
|
||||
return array();
|
||||
|
|
Loading…
Reference in a new issue