cphalcon: [2.1.x][Bug] PHQL subquery cant bind params for it- only for "array" type
Hi there, I think i found a issue with sub-queries. Let get look that example:
$prepare = [
'categories' => [1, 2, 3, 4, 5, 6, 10, 11]
];
$phql = "SELECT * FROM Models\Teachers WHERE id IN (
SELECT teacher_id FROM Models\CategoriesTeachers WHERE category_id IN ({categories:array})
)";
$query = $this->modelsManager->createQuery($phql);
$elements = $query->execute($prepare);
So… Phalcon returns an error for me: “Bind value is required for array type placeholder: categories” - but it is prepared. I try this in older versions of phalcon- still make an error. If i am doing something wrong, please, correct me.
Just one more detail- if i use not array as param, but string or int category_id = {category:int} there is no problem- issue is only with array type.
Thank you!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 28 (24 by maintainers)
Commits related to this issue
- Fixes #11605: Parameters are stored in _bindParams when calling execute — committed to CameronHall/cphalcon by deleted user 6 years ago
- Fixes #11605: Parameters are stored in _bindParams when calling execute — committed to CameronHall/cphalcon by CameronHall 6 years ago
- Fixes #11605: Parameters are stored in _bindParams when calling execute Updated CHANGELOG-3.4.md Fixed failing tests caused by PR#13100 — committed to CameronHall/cphalcon by CameronHall 6 years ago
- Merge pull request #13480 from CameronHall/bugfix/subquery-binded-params Fixes #11605: Parameters are stored in _bindParams when calling query execute — committed to phalcon/cphalcon by niden 6 years ago
Should be resolved as of #13480
Thank you again Cameron
This is still an issue.
@sergeyklay Please add this to the 2.1 milestone as this is very serious for those affected by it and its a regression of relied upon behaviour.
This is affecting me as well. I’m dead in the water.
edit UPDATE: I’ve been able to get this to work by binding the variables first before the execute:
Hi there and thank you for comment. I check now, so:
Still next code did not work - get exception for a missing bind value:
And that is it 😕 Thank you. Wish u luck!