> On Tue, Apr 28, 2009 at 6:41 PM, geste <jim.ho...@gmail.com> wrote:
>
> > I started a project with a bunch of preliminary scaffolded views and
> > those were find for helping us through data structures and
> > relationships. They also all included some nice defaults -- would
> > show "name" by default for a foreign key "id" in index and "view"
> > views. But it was clear I had to move on from many of the scaffolded
> > views to be able to customize.
>
> > I have started to work with non-scaffolded, baked views and how I can
> > customize enogh starting with baked MVC. Not surprisingly, I see some
> > differences. For example, view and index views simply show (not very
> > meaningful) "id" for foreign keys, where I would like to display
> > "name". In the view.ctp I can take something like:
>
> > echo $testRecord['TestRecord']['space_id'];
>
> > and change it to:
>
> > echo $testRecord['Space']['name'];
>
> > but I foresee myself doing this all over the place.
>
> Why is that an issue? Keep in mind that scaffolded views are very
> basic and will almost always require some customisation.
>
> If you have a Model and AssocModel, Cake will always place
> AssocModel's field's in an AsscoModel array in $data. But there's
> nothing stopping you from creating an afterFind() in TestRecord that
> does
>
> $this->data['TestRecord']['space_name'] = $this->data['Space']['name'];
>
> But what's the point, aside from wasting cycles?
Brian,
Personally, I'll take your response to mean "I'm not out of my
mind".
Yes, time to leave scaffolding behind, but there were some helpful
(and not always helpful) defaults like "show name value for FK id".
Like you say, I don't want to add more data for no good reason. I had
some vague notion of a helper that would return "name-for-id" or some
other way of reformatting FK IDs in a way that would be inheritable.
But if there's no fault to find with just editing baked views to show
view vars, then I will go with that. Just figured I'd aske before I
go back and rebake 35 unscaffolded views!
Thanks,
Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment