2011年2月21日星期一

Re: [fw-db] Zend_Db_Table Issue

Hi,

Can you please provide an actual code used by you to delete row, that
throws mentioned error?

Regards,
Joseph Chereshnovsky

On Wed, 2011-02-16 at 01:53 -0200, Rafael wrote:
> 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 ;
>
>
>

没有评论: