You need to have 'hasMany' defined in the Language and Country class.

Also, your table names are not following the cake convention either.
Table names must be plural and not singular. View
http://cakephp.org/files/cakesheet.pdf for more information.


zombie's head wrote:
> Ahoy-hoy,
>
> I've stumbled upon a simple database relationship problem that is
> turning out to not be so simple to solve. Here's the situation I'm
> setting up:
>
> An Issue has an associated Language and Country. I figure by putting a
> key to the Language and Country tables in the Issue, and defining the
> $hasOne relationship in Issue would do the trick. However, when I run
> it I get SQL query errors where CakePHP is looking for
> Language.issue_id and Country.issue_id. Any thoughts?
>
> Here are the basic databases:
>
> create table issue (
>   id int not null auto_increment,
>   language_id int not null,
>   country_id int not null
>   primary key(id)
> );
>
> create table language (
>   id int not null auto_increment,
>   name varchar(255) not null,
>   primary key(id)
> );
>
> create table country (
>   id int not null auto_increment,
>   name varchar(255) not null,
>   primary key(id)
> );
>
> And here are the models:
>
> class Issue extends AppModel
> {
>   var $name = 'Issue';
>   var $hasOne = array('Language' => array('className' => 'Language'),
> 'Country' => array('className' => 'Country'));
> }
>
> class Language extends AppModel
> {
>   var $name = 'Language';
> }
>
> class Country extends AppModel
> {
>   var $name = 'Country';
> }
>
> Any insight to this situation would be appreciated.
>
> Quentin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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