Added an exception when invalid case.
Fixes after code review.
This commit is contained in:
parent
41ec5fd56d
commit
04e6061584
@ -991,24 +991,28 @@ class SqlWalker implements TreeWalker
|
|||||||
'condition' => implode(' AND ', $conditions),
|
'condition' => implode(' AND ', $conditions),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new \BadMethodCallException('Type of association must be one of *_TO_ONE or MANY_TO_MANY');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle WITH clause
|
// Handle WITH clause
|
||||||
$withCondition = (null !== $condExpr) ? ('(' . $this->walkConditionalExpression($condExpr) . ')') : '';
|
$withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')');
|
||||||
|
|
||||||
if ($targetClass->isInheritanceTypeJoined()) {
|
if ($targetClass->isInheritanceTypeJoined()) {
|
||||||
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias);
|
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias);
|
||||||
// If we have WITH condition, we need to build nested joins for target class table and cti joins
|
// If we have WITH condition, we need to build nested joins for target class table and cti joins
|
||||||
if ($withCondition) {
|
if ($withCondition) {
|
||||||
$sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition'] . ' AND ' . $withCondition;
|
$sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition'];
|
||||||
} else {
|
} else {
|
||||||
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins;
|
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'];
|
$sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'];
|
||||||
if ($withCondition) {
|
}
|
||||||
$sql .= ' AND ' . $withCondition;
|
|
||||||
}
|
if ($withCondition) {
|
||||||
|
$sql .= ' AND ' . $withCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the indexes
|
// Apply the indexes
|
||||||
|
Loading…
Reference in New Issue
Block a user