2016-04-05 4 views
1

ich eine Abfrage in einem Modell haben:Falsche Abfrageergebnis in ZF2

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); 
} 

Das Ergebnis ist:

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]=> 
)) 

Es funktioniert, aber es nicht zeigen performance_id in Folge. Was ist los mit meiner Anfrage? Dank

Antwort

0

Modifizieren Sie bitte Ihre Suche:

$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'); 
+0

Können Sie bitte auf eine Erklärung hinzufügen, warum das funktionieren würde und warum der Code in der Frage nicht das gewünschte Ergebnis nicht geben. – Wilt

+0

Bitte beziehen Sie sich auf diese Seite: http://framework.zend.com/manual/current/de/modules/zend.db.sql.html –