ZF-7861: Using namespaced models in relationships within Zend_Db_Table_Abstract


With regards to defining relationships in subclasses of Zend_Db_Table_Abstract:…

It seems that namespaced models are not supported. So I want to do this:

$questionModel = new Blah_Model_Question();
$questionRow = $questionModel->find(5)->current();
$section = $questionRow->findParentSection();

But I have to do this:

$questionModel = new Blah_Model_Question();
$questionRow = $questionModel->find(5)->current();
$section = $questionRow->findParentBlah_Model_Section(); //Not looking good!

My model looks like this:

class Dlapiper_Model_Question extends Dlapiper_Model_Abstract {
    protected $_name = 'questions';
    protected $_primary = 'question_id';
    protected $_referenceMap = array(
        'Section' => array(
            'columns' => 'section_id',
            'refTableClass' => 'Dlapiper_Model_Section',
            'refColumns' => 'section_id'

I cannot see a simple workaround in this situation, so it would be great to have support for this.


While the ->find*() functions are syntactic Sugar they not provide any namespacing or aliasing. Therefor it's pretty useless in bigger Projects.

I usually create Table and Row Classes and write simple proxy functions in the Row Class.

 * @return SectionRow
public function getSection()
  return $this->findParentRow('namespace_SectionTable');

Workaround indeed.