Thanks for the reponse, but is not the solution. I want the
informations in according to the Language too.
On 14 août, 19:10, starkey <[EMAIL PROTECTED]> wrote:
> Try this in your controller:
>
> $data = $this->Country->find('id = ' . $id); // where $id is your
> country id
> pr($data);
>
> Shawn
>
> On Aug 14, 11:28 am, farphadet <[EMAIL PROTECTED]> wrote:
>
> > Hy
>
> > I have this 3 models, and i try to retreive all informations about a
> > country
> > according to the id of a country, and according to a language id (to
> > get the
> > name of the country in the correct language).
>
> > In my countries controller :
>
> > $this->Country->find(array('LangCountries.id' => 1, 'Country.id' =>
> > 1);
>
> > Bu t This doesn't work, it send me an error, because LangCountries is
> > unknown.
>
> > This is my models :
>
> > class Currency extends AppModel {
> > var $name = 'Currency';
> > var $hasMany = array('Country');
>
> > }
>
> > class Country extends AppModel {
>
> > var $name = 'Country';
> > var $belongsTo = array('Currency');
> > var $hasMany = array('LangCountry');
>
> > }
>
> > class LangCountry extends AppModel {
>
> > public $name = 'LangCountry';
> > public $belongsTo = array('Country');
>
> > }
>
> > This is my tables in Database:
>
> > Table "public.countries"
> > Column | Type |
> > Modifiers
> > ----------------------+------------------------
> > +--------------------------------------------------------
> > id | integer | not null default
> > nextval('countries_id_seq'::regclass)
> > currency_id | integer |
> > countries_iso_code_2 | character varying(255) |
> > countries_iso_code_3 | character varying(255) |
> > tel_regexp | character varying(255) |
> > zip_code_regexp | character varying(255) |
> > Indexes:
> > "countries_pkey" PRIMARY KEY, btree (id)
> > Foreign-key constraints:
> > "currencies_id_fkey" FOREIGN KEY (currency_id) REFERENCES
> > currencies(id)
>
> > Table "public.currencies"
> > Column | Type |
> > Modifiers
> > --------+------------------------
> > +---------------------------------------------------------
> > id | integer | not null default
> > nextval('currencies_id_seq'::regclass)
> > title | character varying(255) |
> > code | character varying(255) |
> > symbol | character varying(255) |
> > Indexes:
> > "currencies_pkey" PRIMARY KEY, btree (id)
>
> > Table "public.lang_countries"
> > Column | Type |
> > Modifiers
> > ------------+------------------------
> > +-------------------------------------------------------------
> > id | integer | not null default
> > nextval('lang_countries_id_seq'::regclass)
> > country_id | integer |
> > name | character varying(255) |
> > diminutive | character varying(255) |
> > Indexes:
> > "lang_countries_pkey" PRIMARY KEY, btree (id)
> > Foreign-key constraints:
> > "lang_countries_id_fkey" FOREIGN KEY (country_id) REFERENCES
> > countries(id)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---