ZF-1726: Make the "where" clause parameters more consistent
Old summary: Normalize the "where" clause parameters that are accepted by Zend_Db_Table's fetchAll/fetchRow and update/delete methods.
I noticed that the where parameter for update and delete methods for Zend_Db_Table work a little differently than those for the fetchAll and fetchRow methods. Looking at the code, this seems to be based on the fact that update/delete proxy their corresponding methods in Zend_Db whereas fetchAll/fetchRow use Zend_Db_Select to build their queries. As it is now, all four of the methods accept the where clause either as a string or as an indexed array of strings (though this method is undocumented for fetchAll/fetchRow). The strings from the array are ANDed together without being quoted. e.g.
$where = $table->getAdapter()->quoteInto('bug_id = ?', 1234);
$where = "reported_by = 'goofy'"; $where = "bug_status = 'OPEN'";
However fetchAll/fetchRow also accept another undocumented format for the "where" parameter which automatically does the quoting for you. It takes an associative array where the keys are the condition with a placeholder and the values are the values to be replaced. Values are automatically quoted and terms are joined together using ANDs. e.g.
$where = array('bug_status = ?' => 'NEW', 'reported_by = ?' => 'talawahdotnet'); $rows = $table->fetchAll($where);
It would be nice if theses interfaces where unified and documented so that they accepted all three formats.