我是symfony的新手,我已经花了两天时间使用基于schema.yml的关系来解决使用symfony的问题
schema.yml是
FieldsCategory:
tableName: fld_category
columns:
id:
name: id as FieldsId
type: integer(10)
primary: true
autoincrement: true
category_name:
name: category_name as CategoryName
type: string
default: ''
notnull: true
relations:
FieldsCategory:
class: FieldsCategory
foreignAlias: Fields
local: id
foreign: fields_category_id
Fields:
tableName: fld_fields
columns:
id:
name: id as FieldsId
type: integer(10)
primary: true
autoincrement: true
fields_name:
name: fields_name as FieldsName
type: string
default: ''
notnull: true
fields_desc:
name: fields_desc as FieldsDescription
type: string
default: ''
notnull: true
amount:
name: amount as TotalAmount
type: integer
notnull: true
fields_type_id:
name: fields_type_id as FieldsTypeId
type: integer
fields_category_id:
name: fields_category_id as FieldsCategoryId
type: integer
我的表格是
$this->setWidgets(array(
'FieldsId' => new sfWidgetFormInputHidden(),
'fields_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fields'), 'add_empty' => false)),
'FieldsName' => new sfWidgetFormTextarea(),
));
$this->setValidators(array(
'FieldsId' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('FieldsId')), 'empty_value' => $this->getObject()->get('FieldsId'), 'required' => false)),
'fields_type_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Fields'), 'required' => false)),
'FieldsName' => new sfValidatorString(array('required' => false)),
));
它给了我这个错误
我已经尝试了所有可能的方法,但我无法解决这个问题/
并将提前帮助