Hi,

 

You could use a Zend_Db_Select object associated to your Zend_Db_Table
object.

 

For exemple: 

You have 3 tables (T1, T2, T3).

You want to access T1's fields but you need to join T2 and T3.

In your Zend_Db_Table T1, add this method: 

public static function getT1List() {

         $select = self::getInstance()->select(); 

         $select->setIntegrityCheck(false);

         $select->from(self::getInstance());

         $select->join('T2', 'T1.id_T2 = T2.id_T2', array('your fied's list
from T2 comma separated'));

         $select->join('T3', 'T1.id_T3 = T3.id_T3', array('your fied's list
from T3 comma separated'));

         return self::getInstance()->fetchAll($select);

}

 

The using of static function is not necessary.

 

The command: self::getInstance() is a method's call :

public static function getInstance() {

         if(!isset(self::$instance)) self::$instance = new T1();

         return self::$instance;

}

 

Regards,

Guillaume BABIK

INTERNIM

45, rue Aristide Briand

92300 LEVALLOIS

Tel : 01.40.87.11.20

Fax : 01.47.57.38.87

Mobile : 06.80.21.90.29

 <BLOCKED::http://www.internim.com/> http://www.internim.com

 

Reply via email to