> On 25 Jan., 00:14, Ryan Schmidt wrote:
>> Well, I don't want all belongsTo relations to allow NULL selections; logically, I only want this allowed for those defined in the database as allowing NULL values. So my question is how can I do that, and my second question is why the default cake baking templates don't already do that.
>
> debug your bake scripts variables - especially the content of the
> schema
> it might be in there somewhere if NULL is allowed or not
> then you can easily change the default behavior
Thanks for the suggestion. If I have a moment, maybe I'll see if I can find that.
> well, because its not that important - at least not for anybody
> else :)
> but as the core team would say: "feel free to provide a patch"
> if you do that they might put it in. and you are happy.
Believe me, I'm aware of how open-source projects work. I've worked with the MacPorts project for many years, and wearing that hat, I have many times encouraged people to supply patches for things. With CakePHP, however, I am a beginner, do not have an understanding of how it all works under the hood, and do not feel confident in my ability to craft major patches just yet. Moreover, since CakePHP has been around for years, I would assume that all of the basics have been long taken care of by the framework. So when something that I consider basic (like this issue) does not appear to be taken care of, I must necessarily come to this list first to ask why, since my first assumption is that I have misunderstood something and that the feature I seek does exist but I'm just doing it wrong. But in this case it sounds like it really doesn't exist -- that "bake" really doesn't have this capability right now.
I reject entirely the notion that this issue is not important for anybody else. Certainly you will grant that there are use cases for having a related field where not all records have a related record. You need only consider a previous example I gave, that of having a library tracking who has checked out what book, using a books table that has a user_id column. Not every book is checked out to a user; some are on a shelf in the library. These books would have their user_id column set to NULL. If using a standard baked edit view, I would certainly want the User drop-down menu to allow me to select that this book is not checked out to anybody. Certainly you will acknowledge that database engines like MySQL have been specifically designed with this capability in mind.
The purpose of "bake" is to get me up and running with my project as quickly as possible. That does not mean "bake" should be as simple as possible; it means "bake" should be as complex as possible, accommodating as many common use cases as possible, so that I don't have to spend a lot of time fixing the baked templates afterward. You yourself have argued for this in your blog post about extending the bake templates so that they format different kinds of fields properly (date/time, Boolean):
http://www.dereuromark.de/2010/06/22/cake-bake-custom-templates/
Now I'm arguing for it with regard to properly representing select menus for related fields which could be NULL.
Is it appropriate for me to file a feature request in the CakePHP issue tracker at this point, or what would be the proper procedure to get this request considered?
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment