-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing in Empty Conditions Breaks Query #2244
Comments
Can you please var_dump /**
* Nest the condition to current ones or set as unique
*/
if (zend_is_true(current_conditions)) {
PHALCON_INIT_VAR(new_conditions);
PHALCON_CONCAT_SVSVS(new_conditions, "(", current_conditions, ") AND (", conditions, ")");
} else {
PHALCON_CPY_WRT(new_conditions, conditions);
} |
var_dump($conditions) returns:
Which makes the query:
I understand I can remove that key, and have done so (created a function to iterate over the array passed in as In PHP it could be as easy as:
I'm guessing there is a simple equivalent in C or Zephir. Thanks! |
Fix #2244 add judge conditions in `Phalcon\Mvc\Model\Manager::getRelationRecords`
Using the paginator breaks the query if you pass in empty query conditions.
$order is always empty or valid SQL ("id DESC" or "id DESC, name ASC").
$conditionsis always empty or valid SQL ("id < 3" or "id > 10 AND name ILIKE '%megatron%'").
But if $conditions is empty the query is SELECT [Parts].* FROM [Parts] WHERE AND [robots_id] = ?0 ORDER BY id DESC and fails.
Passing in an empty ["data"]["conditions"] key shouldn't break the query. If it's empty it shouldn't affect the WHERE clause.
The text was updated successfully, but these errors were encountered: