I believe gwoo has created a Workbench -> Cake model script somewhere...IIRC the code for it is in the CakeBin. http://bin.cakephp.org/saved/45105
Found from: http://groups.google.com/group/cake-php/browse_thread/thread/a94d882f105753dc?hide_quotes=no On Jul 8, 8:57 pm, Mike Bates <[email protected]> wrote: > I use it to build my schemas then go to File > Export > forward engineer SQL > CREATE Script. > > That gives the full sql to build the database on mysql, and once cake is > configured to see your db the bake script will pick up everything (as you > probably already know) > > You can also export the ALTER scripts for existing databases. > > You do need to follow the cake naming convension, and you can edit the > settings in workbench at Tools > Options > Model tab. > > I don't know of a way to get workbench to convert plural to singular though, > but it's an easy edit so I haven't bothered to look into it too closely. > > > > On Wed, Jul 8, 2009 at 12:08 PM, Jon Chin <[email protected]> wrote: > > Thanks for the tip. I installed MySQL Workbench. It looks like a sweet > > program, but I'm not totally sure what it does for me. I've imported my > > current database tables and created a few EER diagrams. Other than database > > planning and documentation, what else can this tool do? Is there a way to > > export it to something Cake can interpret? Please enlighten me. > > > 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.html > > >> It'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.- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
