Habtm implementation:
Model::_deleteLinks($id)
"Cascades model deletes through HABTM join keys."

I just found out reason why some records gets randomly deleted from
habtm:
cake ignores 'condition' filed in habtm assocciation definition.
example:
var $hasAndBelongsToMany = array(
                'Tag' =>
                array('className'    => 'Tag',
                    'joinTable'    => 'content_tags',
                    'foreignKey'    => 'content_id',
                    'associationForeignKey'=> 'tag_id',
                    'conditions'    => "content_type='News'",
                   ..
Now, cake will use 'condition' to find results,
but ignore when deleting!

So if you have (in this example) tags for Video,Product,Photo..,
by deleting News with id=1,
cake will delete tags for Product id=1, Video id=1.. and so on.

Delete is often followed by redirect to referrer and hard to debug
sql.

This miss-behavior is in cake 1.x, and, as I can see, in 1.2.x.
You can define  'deleteQuery'=> '' in habtm assocciation but why?

@nate should I open ticket for this?


On May 8, 12:29 am, Nate <[email protected]> wrote:
> Well, maybe hate's a strong word.  Let's say, what do you like the
> least?  Kind of an odd question, I know, but since we've kick-started
> development of a new version, I'd like to know what the most
> frustrating things with the framework are, even if they're things we
> can't fix right away.
>
> I'll get us started: PHP 4 support.
>
> Who's next? TIA for the input.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to