Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [symfony] i18n - nie trzyma referencji w modeku
Cysiaczek
post 16.04.2008, 10:09:56
Post #1





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Witam,

Jeśli tabela główna nie zawiera żadnego pola oprócz ID lub istnieje jakieś, ale nie zostanie uzupełnione treścią, to tabela i18n tej tabeli zostanie wypełniona danymi, ale rekord w głównej tabel nie zostanie utworzony i referencja do głównej tabeli nie zostanie zachowana.

Czy ktoś wie, co należy zrobić, aby można było utworzyć tabelę główną tylko z polem ID ?

Testowy model:
Kod
propel:
  posts:
    _attributes: { phpName: Post, isI18N: true, i18nTable: posts_i18n }
      idMethod: native
    id: { type: integer, required: true, primaryKey: true, autoIncrement: true }
    test:
      type: LONGVARCHAR
      
  posts_i18n:
    _attributes: { phpName: PostI18n }
    id:          { type: integer, required: true, primaryKey: true, foreignTable: posts, foreignReference: id }
    culture:     { isCulture: true, type: varchar, size: 7, required: true, primaryKey: true }
    description: { type: LONGVARCHAR }

i kod
  1. <?php
  2. $o=new Post();
  3. //$o->setTest('aaa'); // z tym działa
  4.  // $o->save(); // z tym nie
  5.  
  6. $o->setCulture('pl');
  7. $o->setDescription('czesc');
  8. $o->save();
  9.  
  10. $o->setCulture('en');
  11. $o->setDescription('hello');
  12. $o->save();
  13. ?>


Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
stachuf11
post 16.04.2008, 20:55:39
Post #2





Grupa: Zarejestrowani
Postów: 154
Pomógł: 1
Dołączył: 24.04.2006

Ostrzeżenie: (0%)
-----


To co napiszę nie jest odpowiedzią na twoje pytanie, tylko obejsciem problemu, ja zrobilem tak że dodalem dodatkowe pole w tabeli glownej typu varchar(2) i wstawiam wartosc ' ' czyli jedna spacje przy zapisie rekordu

Ten post edytował stachuf11 16.04.2008, 20:56:14
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.07.2025 - 06:16