Have another look at your naming conventions, most notably those for your
models.

http://book.cakephp.org/view/24/Model-and-Database-Conventions

On Mon, May 3, 2010 at 10:43 PM, Rodney Chan <[email protected]> wrote:

> I try to follow the example from a book called "CakePHP Application
> Development"
>
> I have created the following table under MySQL
> books(id, isbn, title, description, author_id)
> authors(id, name, email, website)
>
> And created 4 .php files:
>
> C:\xampp\htdocs\relationship\app\models\authors.php
>
> <?php
> class Author extends AppModel
> {
>  var $name = 'Author';
>  var $hasMany = 'Book';
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\models\books.php
>
> <?php
> class Book extends AppModel
> {
>  var $name = 'Book';
>  var $belongsTo = 'Author';
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\controllers\authors_controller.php
>
> <?php
> class AuthorsController extends AppController {
> var $name = 'Authors';
> var $scaffold;
> }
> ?>
>
> C:\xampp\htdocs\relationship\app\controllers\books_controller
>
> <?php
> class BooksController extends AppController {
>  var $name = 'Books';
>  var $scaffold;
> }
> ?>
>
> When I try to view the books (http://localhost/relationship/books),
> author column only shows author_id but not the author name.  Also,
> under edit screen, the combo box for pick up author name is empty.  I
> also tried to remove $hasMany and $belongsTo and the result is the
> same.  It seems that the $hasManay and $belongsTo has no effect at
> all.
>
> Is there anything I missed?
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to