私はsymfony 1.4.11をdoctrineで使用しています。スキーマの一部:symfony sfWidgetFormDoctrine 'multiple' => trueの場合
Companies:
actAs:
Timestampable: ~
Sluggable:
unique: true
fields: [company]
canUpdate: false
builder: [myTools, StripText]
connection: doctrine
tableName: companies
columns:
company_id: { type: integer(4), primary: true, notnull: true, autoincrement: true }
user_id: { type: int(4) }
category_id: { type: int(4), notnull: true }
company: { type: string(255), notnull: true }
address: { type: string(255), notnull: true }
contact_person: { type: string(255), notnull: true }
phone: { type: string(50), notnull: true }
fax: { type: string(50) }
email: { type: string(255), notnull: true}
url: { type: string(50) }
about: { type: string(1000), notnull: true}
country: { type: string(255), notnull: true}
show_ads: { type: boolean, default: 0 }
active: { type: boolean, default: 0 }
has_company: { type: boolean, default: 1 }
relations:
Owner: { onDelete: CASCADE, local: user_id, foreign: id, class: sfGuardUser, foreignAlias: Companies }
Images_companies: { local: company_id, foreign: company_id, type: many, class: Images_companies }
Categories: { onDelete: CASCADE, local: category_id, foreign: category_id , type: many, foreignType: one}
Categories:
actAs:
I18n:
fields: [name]
actAs:
Sluggable:
unique: true
fields: [name]
canUpdate: true
builder: [myTools, StripText]
NestedSet:
hasManyRoots: true
connection: doctrine
tableName: categories
columns:
category_id: { type: integer(4), primary: true, autoincrement: true }
name: string(255)
私はそのユーザーが会社、複数のカテゴリを選択できます。私はsfWidgetFormDoctrineChoiceを使用するので、私は唯一のカテゴリを選択することができ
$this->widgetSchema['category_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Categories', 'add_empty' => false, 'multiple' => false));
ユーザーを持っているとき、それはすべてOKです。 私が持っている:
$this->widgetSchema['category_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Categories', 'add_empty' => false, 'multiple' => true));
そしてCATEGORY_ID = 0保存デシベルで、リストから一つだけカテゴリを選択します。 SQLSTATE [HY093]:無効なパラメータ番号:私は複数のカテゴリを選択すると、私はエラー持ってバインドされた変数の数が、トークン
の数と一致しませんが、私はグーグルで、このエラーを検索しますが、私はしないでください決定を見つけ、私は今どこかに間違ったことをすることはありません。ありがとうございました!
は、私はカテゴリーを変更いただき、ありがとうございます。多くの} '、しかし私はまだエラーがあります... – denys281
私は、文書化とすべての作業のように)ありがとう! – denys281