On Jan 29, 6:01 am, maxarbos <[email protected]> wrote: > I was responding to the the post from Ryan about 'bake' doing what I > was asking for. When I 'run' a project in grails, that is when the > table construction from a model is done, so i thought there was more > to 'bake' than I had originally thought. > > I did go through the blog tutorial as well as the docs on how to > create a model. And from what I remember, in both places I had to > create the db table myself.
omg the manual labor. So where in the blog tutorial did it ask you to define in the model the fields for the db table you'd just created? Where is the suggestion that what you're asking for, edit properties in a model, and the db schema alters to suit, is conceptually compatible with cake? > You give the docs too much credit to think that in 15 minutes I am > supposed to understand why I have to create the db table: 'posts' by > hand (http://book.cakephp.org/view/1530/Creating-the-Blog-Database) > and then little bit later have to create a model 'Post' with only a > property of 'name' that = 'Post' with no other methods. And even then, > the reason for that '$name' property isnt exactly clear as to why it's > needed: 'The $name variable is always a good idea to add, and is used > to overcome some class name oddness in PHP4.' > > I can understand the logic that the model is an interface to that > table, but I dont remember seeing that outlined anywhere. > > So back to my original questions and just to be clear.... > what you are saying is that the only way a table and it's rows are > created are by manually creating them in the db myself, right? That wasn't your original question - and the answer to that question is also no. I understand your original post as a whole to be summarized by: I don't want to have to edit the db AND my php files - I want them to be in sync - how do I do that? and the answer to that paraphrased question is: you. just. edit. the. db. Let's try and cover all bases: * You're being boneheadedly stuborn ;) Cake doesn't work like that. Like that no worky cake. Work like that not: cake. * Cake bases the schema of your models of the schema of the db it's using, not the otherway around and it does this automatically. * If you think the docs are wrong - edit them. * WRT your question, bake generates view files which will reflect the db schema at the time it is run. * The book isn't intended to duplicate all the info that's in the api - another source of info which I'd recommend looking at. * There are other means of editing your db schema - such as the migrations. They aren't in the core and won't ever be afaik ht answers a few things. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
