2009/4/8 FlyLM [ML] <flylm...@gmail.com>:
> 2009/4/8 FlyLM [ML] <flylm...@gmail.com>:
>> Hello,
>>
>> I have started my first "real" project with Symfony and I've some
>> problems and questions.
>>
>> 1) I use Doctrine as ORM and I18N Behavior in my "schema.yml" file to
>> declare localized fields.
>>
>> "Localized" tables were generated with a columns named "lang". I would
>> like to have a relation between this column "lang" and a table where I
>> declared an a available list of languages.
>> I didn't found how I can add a foreign key on the "localized" tables.
>> How can I do it, is it possible ?
>>

For this first question, I've found a way, but it doesn't work (or I
didn't understood something...).

My "languages" table :

ub_language:
  columns:
    id: { type: integer(2), primary: true }
    label: { type: string(64), notnull:true }
    iso: { type: string(2), notnull:true, unique:true }
    rfc: { type: string(5), notnull:true, unique:true }

A table with I18N behavior :

ub_currency:
  actAs:
    I18N:
      fields: [label]
      className: %CLASS%_i18n
  columns:
    id: { type: integer(1), primary:true }
    symbol: { type: string(32), notnull:true }
    label: { type: string(128), notnull:true }


=> I've follow this ticket : http://trac.doctrine-project.org/ticket/1029

So, I've :
--------------------------------------------------------------------------------------------------------------
ub_language:
  columns:
    id: { type: integer(2), primary: true }
    label: { type: string(64), notnull:true }
    iso: { type: string(2), notnull:true, unique:true }
    rfc: { type: string(5), notnull:true, unique:true }
 relations:
    ub_currency_i18n: { local: iso, foreign: lang, type: one, foreignType: one }

ub_currency:
  actAs:
    I18N:
      fields: [label]
      className: %CLASS%_i18n
  columns:
    id: { type: integer(1), primary:true }
    symbol: { type: string(32), notnull:true }
    label: { type: string(128), notnull:true }
--------------------------------------------------------------------------------------------------------------
The generated SQL have not foreign key for columns 'lang'...
Models don't show any relation between language and 'localized' table.

Any idea ?

>> Thanks for your help,
>> Sorry for my english
>>
>> Fabien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to