Bonjour à tous.

Voilà j'ai une erreur avec un select que j'effectue et qui m'ennuie assez bien car il crash tout simplement et ne me permet pas de voir le query SQL.

Voici ma classe:
La fonction incriminée est bien entendu getCenterActive().

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
class Center extends Zend_Db_Table_Abstract {
 
	protected $_name = 'center';
	protected $_primary = 'id';
 
	private $_mappingColumns = array (
						'idCenter'=>'id',
						'centerCode'=>'sCode',
						'centerName'=>'sName',
						'centerPhone'=>'sPhone',
						'centerFax'=>'sFax',
						'idCurrency'=>'fkCurrency',
						'idVat'=>'fkVat',
						'idStatus'=>'fkStatus',
						'centerVatNumber'=>'sVatNumber',
						'centerAddress'=>'sAddress',
						'centerPostCode'=>'sPostCode',
						'centerCity'=>'sCity',
						'centerCountry'=>'sCountry'
						);
	private function prepare(array $logicalKeys) {
		$result = array();
		foreach ($logicalKeys as $key=>$value) {
			if (key_exists($key,$this->_mappingColumns))
				$result[$this->_mappingColumns[$key]] = $value;
		}
		return $result;
	}
	private function prepareWhere($where) {
		$clause = '';
		foreach ($where as $key=>$value) {
			$clause .= $this->_mappingColumns[$key].' = '.$value;
			break;
		}
		return $clause;
	}
 
	public function getCenterActive() {
		$select = $this->select();
		$select->from($this->_name,'id');
		$select->from('currency','sSymbol');
		$select->from($this->_name,$this->_mappingColumns['centerName']);
		$select->from('status','sName');
		//$select->join('status', $this->_name.'.'.$this->_mappingColumns['idStatus'].'= status.id');
		$select->where($this->_name.'.'.$this->_mappingColumns['idStatus'].'= status.id');
		$select->where($this->_name.'.'.$this->_mappingColumns['idCurrency'].'= currency.id');
		//$select->join('currency',$this->_name.'.'.$this->_mappingColumns['idCurrency'].'= currency.id');
		$select->where('status.sName like ?','%Active');
		$select->order($this->_name.'.'.$this->_mappingColumns['centerName']);
		$logger = Zend_Registry::get('logger');
		$logger->info('SQL request of getCenterActive: ['.$select->__toString().']');
		return parent::fetchAll($select);
	}
}
?>
L'erreur renvoyée est "Select query cannot join with another table"

Merci d'avance et bonne journée!