开发者

Zend_Db_Select won't allow column values from joined tables

I am having a problem getting Zend_Db_Select to give me column values from joined tables. For example, this join works:

$select->from(array('a' => 'files'), array('fil_last_name','fil_first_name','fil_middle_name'))               
       ->join(array('b' => 'origination_offices'), 'a.fil_oof_id_fk = b.oof_id_pk', array());

but this doesn't work:

$select->from(array('a' => 'files'), array('fil_last_name','fil_first_name','fil_middle_name'))               
       ->join(array('b' => 'origination_offices'), 'a.fil_oof_id_fk = b.oof_id_pk', array('oof_name'));

nor does this:

$select->from(array('a' => 'files'), array('fil_last_name','fil_first_name','fil_middle_name'))               
       ->join(array('b' => 'origination_offices'), 'a.fil_oof_id_fk = b.oof_id_pk');

The DbTable classes look like this:

class Application_Model_DbTable_Files extends Zend_Db_Table_Abstract {

    protected $_name            = 'files';
    protected $_primary         = 'fil_id_pk';

    protected $_dependentTables =  array(
        'Application_Model_DbTable_NnFilesTags'
    );

    protected $_referenceMap    =  array(
        'refProjects' => array(
            'columns'       =>  array('fil_pro_id_fk'),
            'refTableClass' => 'Application_Model_DbTable_Projects',
            'refColumns'    =>  array('pro_id_pk')
        ),

        'refOriginationOffices' => array(
            'columns'       =>  array('fil_oof_id_fk'),
            'refTableClass' => 'Application_Model_DbTable_OriginationOffices',
            'refColumns'    =>  array('oof_id_pk')
        ),

        'refResponses' =&g开发者_如何学运维t; array(
            'columns'       =>  array('fil_res_id_fk'),
            'refTableClass' => 'Application_Model_DbTable_Responses',
            'refColumns'    =>  array('res_id_pk')
        ),

        'refZipCodes' => array(
            'columns'       =>  array('fil_zip_code_fk'),
            'refTableClass' => 'Application_Model_DbTable_ZipCodes',
            'refColumns'    =>  array('zip_code_pk')
        ),

        'refBoxes' => array(
            'columns'       =>  array('fil_box_id_fk'),
            'refTableClass' => 'Application_Model_DbTable_Boxes',
            'refColumns'    =>  array('box_id_pk')
        )
    );
}

class Application_Model_DbTable_OriginationOffices extends Zend_Db_Table_Abstract {

    protected $_name            = 'origination_offices';
    protected $_primary         = 'oof_id_pk';

    protected $_dependentTables =  array(
        'Application_Model_DbTable_Files'
    );
}

What do I need to do in order to get at the values in the joined table?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜