Hello,

I'm new to cakePHP and I don't know why my associations aren't
working.  I'm trying to associate a game with a genre.  Each game has
a genre_id column which corresponds to a genre in a table named
genres.

My game model looks like this:

<?php
class Game extends AppModel {
        var $name = 'Game';
        var $hasOne = 'Genre';
}
?>

Genre model:

<?php
class Genre extends AppModel {
        var $name = 'Genre';
}
?>

Games controller:

<?php
class GamesController extends AppController {
        var $name = 'Games';

        function index() {
                $this->set('game', $this->Game->find());
        }
}
?>


Now in my games view when I call I try to access $game['Genre'] I get
an undefined index error.  Is there something I'm missing here?

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