Also, when I create a relationship between tables in the program, it creates a new foreign key like this: tablename_id. But Cake syntax is singulartablename_id. Do you know if there's a way to change that Workbench default?
Jon Chin Mike Bates wrote:
Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often complications when you have db design with many to many relationships.Try creating new tables in between them so you can have HABTM between machine and type, machine and category, service and customer.When designing your schema this is a great free tool http://dev.mysql.com/downloads/workbench/5.1.htmlIt'll create an EER diagram for you, and using that as a visual aid helps a lot when putting your schema together.On Wed, Jul 8, 2009 at 8:08 AM, iFeghali <[email protected] <mailto:[email protected]>> wrote:Hello All, I am stuck at a circular relationship problem. This is my scenario: - Machine HABTM Service HABTM Machine - Machine belongsTo Type hasMany Machine - Machine belongsTo Category hasMany Machine - Service belongsTo Customer hasMany Service So far so good. When the user goes to /machine/view it expects to see: [level 0] machine [level 1] machine type [level 1] machine category [level 1] services [level 2] services customers If I set recursive to 1, the last item will not be retrieved. If i set recursive to 2, everything goes well except I get machine records for type, category and services (too much unwanted data). I could let recursive = 2 and manually unbind machine from all other models in the view action, but that would be too much extra code for something apparently simple. note that the given scenario is just an exemplification, my real case has around 8 models tied on a complex "web". I could also made relationships one way only, but obviously it would break the views for the other models. so my question is whether i can set recursive to 2, but tells cake not to retrieve the main model thus preventing "circular data". Thank you. --~--~---------~--~----~------------~-------~--~----~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-~----------~----~----~----~------~----~------~--~---
smime.p7s
Description: S/MIME Cryptographic Signature
