It is user model:
class User extends AppModel
{
var $name = 'User';
var $primaryKey = 'userId';
var $displayField = 'userName';
var $hasMany = array(
'Blog' => array(
'className' => 'Blog',
'foreignKey' => 'blogId',
'dependent' => true,
)
);
}
and it is my blog model:
class Blog extends AppModel
{
var $name = 'Blog';
var $primaryKey = 'blogId';
var $displayField = 'blogTitle';
var $belongsTo = array(
'Blogcategory' => array(
'className' => 'Blogcategory',
'foreignKey' => 'blogCategoryId',
'fields' => 'blogCategoryName',
),
'User' => array(
'className' => 'User',
'foreignKey' => 'userId',
'fields' => 'displayName',
)
);
}
If anyone delete any user, all the blog posts by the very user should
be deleted. Therefore I have set " 'dependent' => true, " in user
model. But when I am deleting any user it is not deleting the blogs of
the very user. What is the prob. in my code?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---