ZF-2102: Add ability to set the class used for statement objects (Zend_Db_Adapter_Pdo_Abstract/Zend_Db_Statement_Pdo)


When running a SELECT query through one of the PDO adapters a Zend_Db_Statement_Pdo object is returned. However if you were to extend Zend_Db_Statement_Pdo with your own class, there is presently no way tell Zend_Db_Adapter_Pdo_Abstract to use that class for new statement objects, as it is hard coded into Zend_Db_Adapter_Pdo_Abstract::prepare().

Could we add the facility to set the class used for new statement objects?


It seems as if you could simply extend the pdo adapter class with a class of your own, overriding the {{prepare()}} method, is this not the case, and if not, why?

Oh you can, and that's exactly what I've done for now. I just thought it would be beneficial to have a way to do it built right in, rather than have to extend the class yourself. Much like you can set the row class in Zend_Db_Table. This would be particularly useful if you needed to do it with more than one type of adapter.

I agree that we should have such support without extending the class. I've lowered the priority to minor, however, since an easy workaround is available.

This issue should have been fixed for the 1.5 release.

Please categorize/fix as needed.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Resolved in r9577

Updating for the 1.6.0 release.