Ajout relation entre table

This commit is contained in:
Michael RICOIS 2010-10-27 09:31:17 +00:00
parent ee1320dc01
commit 4d8bd3b6d9
3 changed files with 17 additions and 4 deletions

View File

@ -3,7 +3,10 @@ class Application_Model_Commandes extends Zend_Db_Table_Abstract
{
protected $_name = 'commandes';
protected $_dependentTables = array('CommandesEven');
protected $_dependentTables = array(
'Application_Model_CommandesEven',
'Application_Model_CommandesPieces',
);
public function insert(array $data)
{

View File

@ -6,8 +6,10 @@ class Application_Model_CommandesEven extends Zend_Db_Table_Abstract
protected $_referenceMap = array(
'CommandesEven' => array(
'columns' => array('commande_id'),
'refTableClass' => 'Commandes',
'refColumns' => array('id'))
'refTableClass' => 'Application_Model_Commandes',
'refColumns' => array('id'),
'onUpdate' => self::CASCADE
),
);
public function insert(array $data)
@ -17,5 +19,4 @@ class Application_Model_CommandesEven extends Zend_Db_Table_Abstract
}
return parent::insert($data);
}
}

View File

@ -2,4 +2,13 @@
class Application_Model_CommandesPieces extends Zend_Db_Table_Abstract
{
protected $_name = 'commandes_pieces';
protected $_referenceMap = array(
'CommandesPieces' => array(
'columns' => array('commande_id'),
'refTableClass' => 'Application_Model_Commandes',
'refColumns' => array('id'),
'onUpdate' => self::CASCADE
),
);
}