#5819: CakePHP Revision 7896: HABTM Issue (deleting one relation deletes other
relations)
-------------------------------+--------------------------------------------
Reporter: milmarqtan | Owner:
Type: Bug | Status: reopened
Priority: Critical | Milestone: 1.2.x.x
Component: Model | Version: RC3
Severity: Critical | Resolution:
Keywords: HABTM Delete | Php_version: PHP 5
Cake_version: 1.2.0.7692 RC3 |
-------------------------------+--------------------------------------------
Changes (by Thalagyrt):
* status: closed => reopened
* resolution: fixed =>
Comment:
This is not fixed. I have a properly set up HABTM table, and in CakePHP
1.2.1.8004 executing Model->delete on ONE record deletes the entire
association - deleting one blog comment disassociates every single comment
from that blog entry. This behavior did not occur in any of the release
candidates.
Unless having a primary key on the two columns, and keys on each
individual column in the table isn't the right way of doing this, and for
all purposes it IS the right way of doing a join table, period, then
something is wrong. Thusly, adding a primary key to the HABTM table
clearly has no effect on this issue.
CREATE TABLE `blogs_comments` (
`blog_id` int(10) unsigned NOT NULL,
`comment_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`blog_id`,`comment_id`),
KEY `comment_id` (`comment_id`),
KEY `blog_id` (`blog_id`),
KEY `comment_id_2` (`comment_id`),
CONSTRAINT `blogs_comments_ibfk_1` FOREIGN KEY (`blog_id`) REFERENCES
`blogs` (`id`) ON DELETE CASCADE,
CONSTRAINT `blogs_comments_ibfk_2` FOREIGN KEY (`comment_id`) REFERENCES
`comments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
--
Ticket URL: <https://trac.cakephp.org/ticket/5819#comment:5>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---