当我尝试从数据库中删除实体时,我需要捕获并处理错误。
[删除记录时出错:SQLSTATE[23000]:完整性约束违规:1451 无法删除或更新父行:外键约束失败(
zdf
.cats
, CONSTRAINTFK_cats_Categories
FOREIGN KEY (category_id
) REFERENCEScategories
(id
) ON DELETE NO ACTION ON UPDATE NO ACTION)]
我尝试通过单击“deleteURL”按钮删除实体
$dbCategories = new Application_Model_DbTable_Categories();
$source = new Bvb_Grid_Source_Zend_Select($dbCategories->getCategoriesByAppId(1, true));
$columns = array('title', 'actions');
$columnsPositions = array('title');
$extraColumns = array(
0 => $this->createExtraColumn(array(
'name' => 'actions',
'position' => 'right',
'title' => 'Actions',
'decorator' => '<a class="edit-button" href="{{editUrl}}"> </a><a class="remove-button" href="{{deleteUrl}}"> </a>'
))
);