>
> 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?
--~--~---------~--~----~------------~-------~--~----~
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