2010-12-30 15 views
0

に問題私はYAMLスキーマDoctrineはモデルを生成 - 関係型

から教義モデルを生成しようとしています、私はそのようなスキーマがあります。

Product: 
    columns: 
     id: 
      type: integer(5) 
      primary: true 
      unsigned: true 
      autoincrement: true 
     activation_time: 
      type: datetime 
      notnull: true 
     enduser_id: 
      type: integer(5) 
      unsigned: true 
      notnull: true 
    relations: 
     Enduser: 
      foreignType: one 
      type: one 
      foreignAlias: Product 

Hostid: 
    columns: 
     id: 
      type: integer(5) 
      primary: true 
      unsigned: true 
      autoincrement: true 
     value: 
      type: string(32) 
      fixed: true 
      notnull: true 

Order: 
    columns: 
     id: 
      type: integer(5) 
      primary: true 
      autoincrement: true 
      unsigned: true 
     expire_date: 
      type: datetime 
     description: 
      type: clob 

Enduser: 
    columns: 
     id: 
      type: integer(5) 
      primary: true 
      unsigned: true 
      autoincrement: true 
     hostid_id: 
      type: integer(5) 
      unsigned: true 
      notnull: true 
     order_id: 
      type: integer(5) 
      unsigned: true 
      notnull: true 
    relations: 
     Order: 
      foreignAlias: Endusers 
     Hostid: 
      foreignAlias: Endusers 

をし、問題が教義によって生成されたモデルが生成-モデル - ということですYAMLはBaseEnduser $商品に 間違ってはDoctrine_Collection

の$ this - > hasManyの( '商品'、アレイ( 'ローカル' => 'ID' '外来' => 'enduser_id'))として定義されます。

代わりに商品オブジェクト

どうしたのですか?

関係が foreignTypeのように定義される:1 タイプ:1 ​​

答えて

0

one-to-one exampleにAccodring、あなただけの残りの部分はIMO罰金だ "製品"

relations: 
    Enduser: 
     foreignType: one 

のために行います。あなたが何をしたいのか分からずにエンドユーザのリファレンスを保存するだけなので、何かを定義する必要はありません(ユーザは何もしたくないし、その逆もありません)

+0

あなたが書いたように(foreignType:one)、それは動作していません;( – mrok

+0

あなたはデータベースを作成してDoctrineがあなたのためにモデル/ ymlを生成させる可能性はありますか? – DrColossos

+0

私はそれを解決しました。タブの代わりに私は2スペースを使用し、すべてうまくいった。 – mrok