ZF-5718: Update the documentation 13.4.3.6 to reflect new behaviour regarding passed array values
Description
Please update the documentation 13.4.3.6 to reflect new behaviour of where() regarding passed array values. From the code comment:
* If a value is passed as the second param, it will be quoted
* and replaced into the condition wherever a question-mark
* appears. Array values are quoted and comma-separated.
Suggest alteration: "The second argument to the where() method is optional. It is a value to substitute into the expression. Zend_Db_Select quotes the value and substitutes it for a question-mark ("?") symbol in the expression. Array values are quoted and comma-separated, e.g. for use in IN clauses."
A code sample could be
// Build this query:
// SELECT product_id, product_name, price
// FROM "products"
// WHERE name IN ('O\'Reilly','McIntosh','Amazon')
$nameArray=array("O'Reilly","McIntosh","Amazon");
$select = $db->select()
->from('products',
array('product_id', 'product_name', 'price'))
->where('product_name IN ?',$nameArray);
I spent some time writing code to do this myself before I read the where() function comment ...
Comments
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-02-16T06:59:03.000+0000
Set component and auto reassign
Posted by Satoru Yoshida (satoruyoshida) on 2009-08-26T20:45:17.000+0000
This issue may consist of 3 tasks.
1) change phpdoc of the where() and other methods that call $this->_adapter->quoteInto..
for example in where() now: @param string $value OPTIONAL A single value to quote into the condition. should be : @param mixed $value OPTIONAL A value to quote into the condition.
2) change following paragraph in en/module_specs/Zend_Db_Select.xml
3) add 1 example in the same xml.
Posted by Satoru Yoshida (satoruyoshida) on 2009-12-05T21:36:26.000+0000
Solved in SVN trunk r19445 and r19446