CakePHP HABTM relationships and deleting -


i'm writing cake app i'm trying model situation group has permissions services, , users in group can have subset of permissions. if group loses permission service, users in group should lose permission.

my tables:

groups (id), services (id), groups_services (id, service_id, group_id), users (id, group_id), users_services (id, groups_services_id, user_id) 

currently, groups has habtm relationship services. problem if remove group service, should removed users in group well. know cakephp can having dependent => true defined on model relationship, in case, users_services dependent on join table, groups_services, represents habtm, don't think work. have break habtm relationship in order work, , use instead groups hasmany groups_services , services hasmany group_services?

from the cookbook:

habtm data treated complete set, each time new data association added complete set of associated rows in database dropped , created again need pass whole data set saving. alternative using habtm see hasmany through (the join model)

so, habtm pretty 'dumb' relationships.

in situations want kind of fine-grained control, habtm isn't fit.

so, short answer, yes. break habtm , use has many through, thought.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -