具有两个类别和关系的形式

| 我在教义1.2中有:
User:
  columns:
    login:        { type: string(255), notnull: true }
    password:     { type: string(255), notnull: true }

Student:
  columns:
    user_id:         { type: integer, notnull: true }
    school_name:     { type: string(255) }
    school_year:     { type: integer(4) }
  relations:
    User:  { onDelete: CASCADE, local: user_id, foreign: id }

Teacher:
  columns:
    user_id:   { type: integer, notnull: true }
    city:      { type: string(255) }
    street:    { type: string(255) }
  relations:
    User:  { onDelete: CASCADE, local: user_id, foreign: id }
如果我打开localhost / user / new有以下格式:
login:
password:
很好 如果我以格式打开localhost / student / new have:
user_id
school_name:
school_year:
但我想:
login:
password:
school_name:
school_year:
这该怎么做?感谢帮助!     
已邀请:
        您必须使用一个称为embedRelation的sfForm方法。您必须创建一个扩展userForm的新表单,并(在configure方法中)与Student设置embed关系。 例如:
class UserStudentForm extends UserForm
{
  public function configure()
  {
    // Existing Student forms
    $this->embedRelation(\'Student\');

    $this->widgetSchema->setNameFormat(\'user_student[%s]\');
  }
}
检查此示例,该示例完美说明了如何使用它。     

要回复问题请先登录注册