【问题标题】:Symfony 1.4 backend two forms in oneSymfony 1.4 后端两种形式合二为一
【发布时间】:2012-07-17 09:05:50
【问题描述】:

在我的后端,我有一个用于创建客户的表单,但我需要为这些客户分配少量描述。

现在我有两种形式,一种用于创建和修改有关客户的信息,另一种用于添加或修改分配给该客户的描述行。 如果可能的话,我希望创建和修改客户数据和客户描述数据。

我知道如何创建表单和修改默认值,但我不知道如何将模型的两种表单以一对多的关系集成。

我的架构:

InfoClient:
  tableName: info_client
  columns:
    id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true 
    info_client_type_id:
      type: integer(4)
      notnull: true
    name_info_client: 
      type: string(255)
      notnull: true
      unique: true

  relations:
    InfoClientLine:
      type: many
      local: id
      foreign: info_client_id

InfoClientLine:
  tableName: info_client_line
  columns:
    id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true 
    info_client_id:
      type: integer(4)
    texto:
      type: string()
    info_client_line_type_id:
      type: integer(4)
      notnull: true

我使用为 symfony 创建的默认配置文件。 以及为 symfony 创建的默认模型。

【问题讨论】:

    标签: forms symfony-1.4 yaml backend


    【解决方案1】:

    您有a great example in the official documentation关于一个案例:这种形式的产品的许多照片:

    为你:

    • Product -> InfoClient
    • Photo -> InfoClientLine

    【讨论】:

    • @jOK 非常感谢,我不知道这些示例章节的存在。
    猜你喜欢
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多