My problem getting Zend Framework to provide a DRI layer can now be summarized as such.
Using the class definitions below I am able to delete the user but not the related comment through my local UserController "public/users/delete/userId/22", even though I have set up a refernece map and table relationship definition.
Does anyone have any answers to why the associated comment record is not deleted when i delete the users record?
class Default_Model_DbTable_Comment extends Zend_Db_Table_Abstract
{
/**
* @var string Name of the database table
*/
protected $_name = 'comment';
/**
* @desc reference map
*
* Rows in the comment table are to be automatically deleted if the row in the
* User table to which they refer is deleted
*
*/
protected $_referenceMap = array(
'User' => array(
'columns' => 'user_id', // the foreign key(s)
'refTableClass' => 'Default_Model_DbTable_Users',
'refColumns' => 'id',
'onDelete' => self::CASCADE,
)
);
}
class Default_Model_DbTable_Users extends Zend_Db_Table_Abstract
{
/**
* @var string Name of the database table
*/
protected $_name = 'users';
/**
* @desc Defining referential integrity here since we are using MyISAM
* Dependent tables are referred via the class name.
*/
protected $_dependentTables = 'Default_Model_DbTable_Comment';
}