Issues

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

Set component and auto reassign

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



    This method accepts only one parameter. If you have an expression into which you
    need to substitute multiple variables, you must format the string manually,
    interpolating variables and performing quoting yourself.

3) add 1 example in the same xml.

Solved in SVN trunk r19445 and r19446