ZF-2286: Add a _setupRowClass() method to Zend_Db_Table_Abstract

Issue Type: Improvement Created: 2007-12-09T11:51:10.000+0000 Last Updated: 2009-07-17T08:40:43.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Jack Sleight (jacksleight) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: - ZF-3486



This will allow for easily setting row classes based on a common naming convention, eg:

<pre class="highlight">
abstract class My_Db_Table_Abstract extends Zend_Db_Table_Abstract
    protected function _setup()
    protected function _setupRowClass()
        if (class_exists($class = get_class($this) . '_Row')) {
            $this->_rowClass = $class;


Posted by Simon Mundy (peptolab) on 2008-02-16T21:36:38.000+0000

But doesn't this depend on the rowClass being available at the time of instantiation? Or are you envisaging a 'require_once' within your table definition to have this class definition pre-loaded?

I'd recommend something more reliable... like, say, a Zend_Db_Table_Plugin to set this during an init() event ;)

Posted by Jack Sleight (jacksleight) on 2008-02-17T05:41:35.000+0000

Well yes, it would rely on the rowClass being available during instantiation, but then in most cases the auto loader would include it when the class_exists is run. But then, this might not necessarily have to rely on the class being loaded. I didn't see the implementation of _setupRowClass above as the default, it's simply a method you can override if you wish to set the row class in a consistent manner across all tables, rather than setting the _rowClass property manually in every table class. In exactly the same way we already have _setupTableName.

This is of course something that could be done with a table plugin (once that's ready :) ), as the whole purpose of the plugin proposal is to remove the need to extend Zend_Db_Table_Abstract with another abstract class implementing custom logic, and you could say exactly the same about _setupTableName.

Posted by Wil Sinclair (wil) on 2008-03-25T20:43:51.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2009-01-06T10:56:38.000+0000

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

Posted by Ralph Schindler (ralph) on 2009-01-10T10:55:51.000+0000

Not sure if this is the solution we want, but the feature is linked (in a round about way) to another feature request

Posted by Ralph Schindler (ralph) on 2009-07-17T08:40:42.000+0000

I think between the concrete instantiation coming in 1.9 and the Zend_Application autoloader from 1.8, I think we having this feature in place.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.