Tuesday, December 1, 2009

Re: scaffolding and displayField

Sorry for the noise: this article
http://www.packtpub.com/article/working-with-simple-associations-using-cakephp
uses authors.php and books.php for model files which is obviously wrong,
since it should be author.php book.php

Lorenzo Bettini wrote:
> Hi
>
> I have two very simple models
>
> class Author extends AppModel
> {
> var $name = 'Author';
> var $displayField = 'name';
> var $hasMany = 'Book';
> }
>
> class Book extends AppModel
> {
> var $name = 'Book';
> var $belongsTo = 'Author';
> }
>
> and the corresponding controllers with scaffolding
>
> class AuthorsController extends AppController {
> var $name = 'Authors';
> var $scaffold;
> }
>
> class BooksController extends AppController {
> var $name = 'Books';
> var $scaffold;
> }
>
> according to the documentation
> http://book.cakephp.org/view/105/Scaffolding I should see the author's
> name when listing books instead of his id, while it's not like that...
> where am I going wrong, please?
>
> thanks in advance
> Lorenzo
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: