Why dont you just do it in the way it was supposed to be? By adding
referential integrity to the database.
For example:
FOREIGN KEY (tablename_id) REFERENCES tablename ON DELETE CASCADE

On Aug 20, 8:50 am, Dave J <[EMAIL PROTECTED]> wrote:
> Not sure if I made sense in my previous post, but basically this is a
> case in which, if you're in a situation where you need to delete
> dependent records in an HABTM relationship..... you might need to
> think if the relationship should be an HABTM one at all... or if a
> simpler hasMany would do the job just as well.
>
> On Aug 20, 2:44 pm, Dave J <[EMAIL PROTECTED]> wrote:
>
> > I dont think it works for HABTM relations....  also for the reason
> > that it might be unsafe to do so. By deleting all related records, you
> > might also be deleting records which are referenced to by other
> > entries in the join table.
>
> > On Aug 20, 4:03 am, Marcello <[EMAIL PROTECTED]> wrote:
>
> > > it does not work (gives no error, but does not remove the dependent
> > > side)
>
> > > On 19 ago, 22:26, Marcello <[EMAIL PROTECTED]> wrote:
>
> > > > dependent is exactly what i was looking for
>
> > > > thanks!
>
> > > > On 19 ago, 22:11, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > > > > Take a look athttp://book.cakephp.org/view/66/models#deleting-data-516
> > > > > .  The 'dependent' parameter can also be set in the model association
> > > > > definition.
>
> > > > > Hope that's what you were looking for.
> > > > > -J.
>
> > > > > On Aug 19, 8:52 pm, Marcello <[EMAIL PROTECTED]> wrote:
>
> > > > > > i got 2 tables linked by a HABTM relationship
>
> > > > > > when i delete table record 1 i want to delete the relationship with
> > > > > > table and the table 2 record as well
> > > > > > but when i delete from table 2 i want to keep table 1 record
>
> > > > > > is there any feature in cakephp for cascading in habtm?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to