Zend_Db_Table 级联 DELETE 不起作用

发布于 2024-10-17 23:32:08 字数 1458 浏览 4 评论 0原文

我正在开发一个使用 zend Framework 1.10、PHP 5.3 和 MySQL 管理律师事务所的应用程序,我已经在两个表之间建立了关系,我想做级联删除,但是它不起作用,我尝试了所有可能性,但什么也没做。这

是父模型,引用所有进程,

<?php
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
        )
    );

当我要删除一个进程时,它会返回给我

注意:未定义索引:C:\htdocs\Advocacia\library\Zend\Db\Table\Abstract.php 第 1197 行中的 numero_atual

删除了进程,但所有进程的状态都保留在数据库中。

任何人都可以看出有什么问题吗?

I am developing an application to manage a law office using zend framework 1.10,PHP 5.3 and MySQL, I have made a relationship between two tables and I wanted to do cascade deletion however It doesn't work, I tried all possibilities but nothing...

this is the parent model, refer to all processes

<?php
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
        )
    );    

here is the model which refer to a process's status

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
        )
    );

When I am gonna delete one process it returns me

Notice: Undefined index: numero_atual in C:\htdocs\Advocacia\library\Zend\Db\Table\Abstract.php on line 1197

it delete the process but all process's status keeps on the datebase.

Anybody can see anything wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花ソ最美的依靠 2024-10-24 23:32:09

将numero_atual添加到primary中,解决问题。

protected $_primary = array("id", "numero_atual");

Adding numero_atual to primary, solve the problem.

protected $_primary = array("id", "numero_atual");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文