ZF2中的查询结果不正确

时间:2016-04-05 03:32:43

标签: php mysql zend-framework2

我在模型中有一个查询:

session('errorName')

结果是:

public function loadPerform(){
    $select = $this->select()
              ->from(array('p' => $this->_tables['performance']))
              ->join(array('phc' => $this->_tables['perf_has_component']), 'phc.performance_id=p.performance_id', array('*'), 'left');
    //echo str_replace('"','',$select->getSqlString())."<br />";
   return $this->fetchAll($select);
}

它有效,但它没有在结果中显示Array([0]=>Array( [performance_id]=> [title]=>Performance11 [description]=>haha [create_dtm]=>2016-04-0500: 14: 54 [create_by]=>90141063 [phc_id]=> [last_update_dtm]=> [update_by]=> )) 。我的查询有什么问题?感谢

1 个答案:

答案 0 :(得分:0)

请修改您的查询:

$select = $this->select()
              ->from(array('p' => $this->_tables['performance']),array('performance_id'))
              ->join(array('phc' => $this->_tables['perf_has_component']), 'phc.performance_id=p.performance_id', array('*'), 'left');