Zend_Db_Table 级联 DELETE 不起作用
我正在开发一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将numero_atual添加到primary中,解决问题。
Adding numero_atual to primary, solve the problem.