Yes, unfortunately it is dependent on DBMS. For example, zend_db(_table) does not support sequences for MySQL. But supports it for Oracle or PgSQL since those DBMS have native support for sequences but MySQL does not.
Regards, On Fri, Feb 18, 2011 at 12:44 AM, Rafael <[email protected]> wrote: > David, > > But Zend_Db_Table isn't independent of database? It should anyway perform > cascade deletion, right? I really would like to have it on the code. I don't > why it is not working. > > > Em 17/02/2011 03:37, David Muir escreveu: >> >> >> http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascading >> >> Unless I'm mistaken InnoDB has native support for DRI, so you should be >> declaring cascades in the database, instead of your table class. >> >> Cheers, >> David > > Hello, > > I don't know if it is the right to ask however i have one issue that nobody > else managed to solve it. > > I'm using zend framework 1.11.3, PHP 5.3 and MySQL 5.1 configured with > InnoDB engine. I'm trying to make a relationship between two tables > to apply cascade deletion but deletes only parental row and return me > > Notice: Undefined index: numero_atual in > C:\htdocs\Advocacia\library\Zend\Db\Table\Abstract.php on line 1197 > > It happens when i try to delete one row from the model > Application_Model_ProcessosJudicial , I really can't see anything wrong in > the code or... > > I would be thankful if anyone check it for me > > class Application_Model_ProcessosJudicial extends Zend_Db_table { > > protected $_name = "processos_judicial"; > protected $_dependentTables = array('Application_Model_Partes', > 'Application_Model_Andamentos'); > > protected $_referenceMap = array( > 'Andamento' => array( > 'columns' => array('numero_atual'), > 'refColumns' => array('numero_atual'), > 'refTableClass' => 'Application_Model_Andamentos', > 'onDelete' => self::CASCADE, > 'onUpdate' => self::RESTRICT > ) > ); > > } > > > class Application_Model_Andamentos extends Zend_Db_table { > > protected $_name = "processos_andamentos_judicial"; > > protected $_referenceMap = array( > 'Andamento' => array( > 'refTableClass' => 'Application_Model_ProcessosJudicial', > 'refColumns' => array('numero_atual'), > 'columns' => array('numero_atual'), > 'onDelete' => self::CASCADE, > 'onUpdate' => self::RESTRICT > ) > ); > > } > > My table structure > > > CREATE TABLE IF NOT EXISTS `processos_andamentos_judicial` ( > `id` int(11) NOT NULL AUTO_INCREMENT, > `numero_atual` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `data` datetime DEFAULT NULL, > `andamento` varchar(60) CHARACTER SET latin1 DEFAULT NULL, > `complemento` varchar(60) CHARACTER SET latin1 DEFAULT NULL, > `observacao` longtext CHARACTER SET latin1, > `tipo_processo` varchar(45) CHARACTER SET latin1 DEFAULT NULL, > PRIMARY KEY (`id`), > KEY `numero` (`numero_atual`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ; > > CREATE TABLE IF NOT EXISTS `processos_judicial` ( > `id` int(11) NOT NULL AUTO_INCREMENT, > `numero_atual` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `numero_antigo` varchar(30) CHARACTER SET latin1 DEFAULT '', > `data_distribuicao` date DEFAULT NULL, > `orgao` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `circunscricao` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `local` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `feito` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `rito` varchar(45) CHARACTER SET latin1 DEFAULT NULL, > `fase` varchar(45) CHARACTER SET latin1 DEFAULT NULL, > `encerrado` tinyint(1) DEFAULT NULL, > `encerrado_data` date DEFAULT NULL, > `encerrado_motivo` varchar(45) CHARACTER SET latin1 DEFAULT NULL, > `suspenso` tinyint(1) DEFAULT NULL, > `suspenso_data` date DEFAULT NULL, > `valor_causa` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `assistencia_gratuita` tinyint(1) DEFAULT NULL, > `percentual` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `resumo` varchar(30) CHARACTER SET latin1 DEFAULT NULL, > `ultima_modificao` datetime DEFAULT NULL, > `criacao` datetime DEFAULT NULL, > PRIMARY KEY (`id`), > KEY `numero_atual` (`numero_atual`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=43 ; >
