Skip to content
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

[Elements] Allow array parameter binding for listing conditions #4265

Merged
merged 4 commits into from Apr 23, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Update docs

  • Loading branch information...
dvesh3 committed Apr 23, 2019
commit 84ee9f1861ef300cb1224c8e07348cad1a8d44dd
@@ -88,7 +88,12 @@ $entries->setCondition("name LIKE ?", ["%bernie%"]); // use prepared statements!
$entries->setCondition("name LIKE :name", ["name" => "%bernie%"]); // With PDO_Mysql you can use named parameters
// to add param to the condition (until build 181 this cannot be used with setCondition in the same listing, you should use setCondition OR addConditionParam but not both)
$entries->addConditionParam("city = ?", "New York", "AND"); // concatenator can be AND or OR
//use array bindings for prepared statements (since version 5.8.0)
$entries->setCondition("city IN (?)", [["New York", "Chicago"]]);
// or
$entries->setCondition("city IN (:cities)", ["cities" => ["New York", "Chicago"]]); // With PDO_Mysql you can use named parameters
//if necessary you can of course custom build your query
$entries->setCondition("name LIKE " . $entries->quote("%bernie%")); // make sure that you quote variables in conditions!
foreach ($entries as $entry) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.