Php Zend fetchall无法返回主ID

Php Zend fetchall无法返回主ID,php,zend-framework,zend-db,zend-db-table,Php,Zend Framework,Zend Db,Zend Db Table,我无法获取主id数组,我尝试在使用joinLeft函数时调试它 这是我的剧本 //setIntegrityCheck to false to allow joins $roomModel = new self(); $select = $roomModel->select(Zend_Db_Table::SELECT_WITH_FROM_PART) ->setIntegrityCheck(FALSE);

我无法获取主id数组,我尝试在使用joinLeft函数时调试它

这是我的剧本

 //setIntegrityCheck to false to allow joins
        $roomModel = new self();

        $select = $roomModel->select(Zend_Db_Table::SELECT_WITH_FROM_PART)
                ->setIntegrityCheck(FALSE);

        //performs join aliasing table room_type to t
        $select->join(array('t' => 'room_types'), 't.room_type_id = rooms.room_type_id AND num_beds> '.$number_beds);
        ////performs join aliasing table room_status to s
        $select->join(array('s' => 'room_statuses'), 's.room_status_id = rooms.room_status_id');

        $select->joinLeft(array('chin' => 'checkin'), 'chin.checkin_date > '.$checkin.' AND chin.checkin_date <'.$checkout.'');


        $select->joinLeft(array('chout' => 'checkout'), 'chout.checkout_date >'.$checkin.' AND chout.checkout_date <'.$checkout.'');


        $result = $roomModel->fetchAll($select);

发生这种情况的原因是什么?

您要加入的一个表也可能包含一个名为“主键”的列,如果该行不存在,它将用null覆盖该列

您应该从每个表中选择所需的列:

$select->join('table', 'condition', array('column1', 'column2', 'column3'));
$select->joinLeft('table', 'condition', array('column1', 'column2', 'column3'));