After a few months I came to a different point of view, though.
You totally misunderstood the message behind my article if you state
that i was arguing in your direction.
What I really meant was that the default templates are quite useless
for the final project. That you MUST create your own bake templates.
For a serious cake app there is no way around it. Simply, because it
is not possible to cover all possible use cases, you must adjust it
yourself. And i gave some hints how to create the most powerful
templates covering a lot of use cases and automatically handling a lot
of stuff.
Of course I would love to have those in the default templates. But it
will never happen, because others have totally different ideas of how
the template should be "enhanced".
Thats way everybody creates his own :) and doesnt use the default
templates. This little bit of work should not hurt too much -
considering the beautiful results.
And no, the bake templates should NOT necessarily be as complex as
possible.
that would have to be the case if they could not be overridden. but
since they can, they don't have to be.
They must at least cover the basic aspects of usability and security.
Thats way I filed a ticket regarding the missing h() escaping which is
now in the core :)
you can certainly open a ticket for it. for selected boxes, it should
then append array("empty"=>true) in the options param.
I do see the advantage of it - most times the first record is selected
automatically which can be annoying (especially if there is no "empty"
value to switch back to).
So even with required select boxes the default value should be "empty"
instead of selecting the first one.
Since this is probably still controversial you should provide a
complete "patch" in order to get your ticket approved without lots of
debating.
but you would have my vote.
mark
On 1 Feb., 14:35, Ryan Schmidt <google-2...@ryandesign.com> wrote:
> On Jan 24, 2011, at 17:37, euromark wrote:
>
> > 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