You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when using getRelated() method in a model with non-trivial find paramaters, for example while using OR in a condition, it behaves strangely and bad query is generated for me.
and I think that $value should be wrapped inside brackets as well. Because related records have this implicit equality condition on foreign key columns.
But when using OR keyword inside parameters when calling getRelated() instead of condition like this:
[
'conditions' => '<foreign-key-cond> AND (<cond1> OR <cond2>)'
]
is generated only this
[
'conditions' => '<foreign-key-cond> AND <cond1> OR <cond2>'
]
Which is obviously wrong. This can be fixed manually by including the brackets in the condition:
return $this->getRelated('relatedAlias', [
'conditions' => '(<cond1> OR <cond2>)' // without brackets it doesn't work
]);
But from the users point of the view it should be better to do it automatically. Because users do not need to know about any of the implicit conditions.
The text was updated successfully, but these errors were encountered:
Hi,
when using getRelated() method in a model with non-trivial find paramaters, for example while using OR in a condition, it behaves strangely and bad query is generated for me.
I think is an error on these lines:
https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/manager.zep#L1130
https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/manager.zep#L1151
and I think that $value should be wrapped inside brackets as well. Because related records have this implicit equality condition on foreign key columns.
But when using OR keyword inside parameters when calling getRelated() instead of condition like this:
is generated only this
Which is obviously wrong. This can be fixed manually by including the brackets in the condition:
But from the users point of the view it should be better to do it automatically. Because users do not need to know about any of the implicit conditions.
The text was updated successfully, but these errors were encountered: