ZF-2144: Allow where() to accept array as input


Zend_Db_Select::where() should be able to accept arrays as input...

This can simplify input like in the following example: old:

$db->where('column1 = ?', 2)
       ->where('column2 = ?', 5)
       ->where('column3 = ?', 10);


$array = array(
    'column1' => 2,
    'column2' => 5,
    'column3' => 10);

This is of course only supported if named arrays are given. The values from numeric arrays would be used for replacing existing placeholders


Assigning to [~thomas].

Setting this to Nice to Have for project management purposes. When it is completed it will be included in the release, it just won't be prioritized for completion by a member of the Zend team. All yours, Thomas. ;)

Actually I've discussed, with darby and simon, all 4 issues related to change the "where" clause where this issue also belongs to.

We already set the things on the road and cleared the acceptable use cases. So I'll do my best :-)

Assigned to Darby because all other related and dependend issues are related to him

If you want to work on this, please don't hesitate to reassign any Db-related issue that is currently assigned to me, including the ones on which this depends, as I won't likely have any time to get to them until after this release anyway.

I'm being affected by this issue as well, and was going to file a new bug, until I saw this. However, shouldn't the the array look more like this?

$array = array(
'column1 = ?' => 1,
'column2 = ?'  => 'string',
'column3 = ?' => $var);

No, you are not affected by this... ;-)

Until now array are not supported as described here and this feature is, for now, not integrated. So you can't be affected by an issue which is not integrated nor described.

It will be integrated after 1.5 is out.

Class will be reworked by Simon... sorry if I confused anybody. He has a better overview over the complete Db design, not only Zend_Db_Select and will help better than me.

Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.

I'd like to see a use case with the latest Zend_Db_Select where this would be particularly useful.

Simon, is this a change that makes sense with the current Zend_Db_Select? If so, please schedule for a fix. I personally would like to see an example where it significantly clarifies or reduces code.

This issue has gone unaddressed for too long. I'm reassigning this to Ralph for re-evaluation and categorization.

Is this something that can still be implemented for ZFv1? Or should it be postponed to 2.0?

After reviewing, I agree with Wil: I don't see a situation where this would significantly improve, clarify or simplify the use of Zend_Db_Select. It's also been hanging around for half a decade now, so if it were necessary it would have been implemented by now. Closing as won't fix.