ZF-2144: Allow where() to accept array as input
Description
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);
simplified:
$array = array(
'column1' => 2,
'column2' => 5,
'column3' => 10);
$db->where($array);
This is of course only supported if named arrays are given. The values from numeric arrays would be used for replacing existing placeholders
Comments
Posted by Darby Felton (darby) on 2007-11-05T14:46:42.000+0000
Assigning to [~thomas].
Posted by Wil Sinclair (wil) on 2007-11-08T22:01:23.000+0000
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. ;)
Posted by Thomas Weidner (thomas) on 2007-11-09T01:01:54.000+0000
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 :-)
Posted by Thomas Weidner (thomas) on 2008-01-17T15:32:56.000+0000
Assigned to Darby because all other related and dependend issues are related to him
Posted by Darby Felton (darby) on 2008-01-17T16:04:48.000+0000
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.
Posted by Eric Marden (xentek) on 2008-02-29T08:48:14.000+0000
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?
Posted by Thomas Weidner (thomas) on 2008-02-29T09:09:26.000+0000
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.
Posted by Thomas Weidner (thomas) on 2008-03-11T03:35:01.000+0000
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.
Posted by Wil Sinclair (wil) on 2008-03-25T22:06:44.000+0000
Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.
Posted by Wil Sinclair (wil) on 2008-06-09T12:53:08.000+0000
I'd like to see a use case with the latest Zend_Db_Select where this would be particularly useful.
Posted by Wil Sinclair (wil) on 2008-06-09T13:37:19.000+0000
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.
Posted by Wil Sinclair (wil) on 2009-01-06T10:57:03.000+0000
This issue has gone unaddressed for too long. I'm reassigning this to Ralph for re-evaluation and categorization.
Posted by Adam Lundrigan (adamlundrigan) on 2011-12-02T02:10:48.000+0000
Is this something that can still be implemented for ZFv1? Or should it be postponed to 2.0?
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-05T22:53:07.000+0000
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.