使用单个提交按钮symfony2提交多个表单

时间:2013-02-09 03:12:33

标签: symfony

我有一个餐厅的项目,我必须为一个订单创建多个行条目。 我有两个表,如下所示

Ajatus\FoodcrmBundle\Entity\Customerorder:
type: entity
table: customerOrder
repositoryClass: Ajatus\FoodcrmBundle\Repository\CustomerorderRepository
fields:
    id:
        id: true
        type: integer
        unsigned: false
        nullable: false
        generator:
            strategy: IDENTITY
    customername:
        type: string
        length: 500
        fixed: false
        nullable: false
        column: customerName
    address:
        type: text
        nullable: false
    phoneno:
        type: string
        length: 12
        fixed: false
        nullable: false
        column: phoneNo
    emailid:
        type: string
        length: 500
        fixed: false
        nullable: true
        column: emailId
    orderdatetime:
        type: datetime
        nullable: false
        column: orderDateTime
    expecteddeliverytime:
        type: integer
        unsigned: false
        nullable: true
        column: expectedDeliveryTime
    locationid:
        type: integer
        unsigned: false
        nullable: false
    storeid:
        type: integer
        unsigned: false
        nullable: false
    deliverydatetime:
        type: datetime
        nullable: true
        column: deliveryDateTime
    salesuserid: 
        type: integer
        unsigned: false
        nullable: false
    orderstatus:
        type: string
        length: 500
        fixed: false
        nullable: true
        column: orderStatus
    iscancelled:
        type: boolean
        nullable: false
    status:
        type: boolean
        nullable: false
    deletestatus:
        type: boolean
        nullable: false
        column: deleteStatus
oneToMany:
    orderidlink:
        targetEntity: Orderdetails
        mappedBy: customerorder
manyToOne:
    storelocation:
        targetEntity: Storelocation
        inversedBy: customerorderstore
        joinColumn:
            name: storeid
            referencedColumnName: id
    location:
        targetEntity: Location
        inversedBy: customerorderlocation
        joinColumn:
            name: locationid
            referencedColumnName: id
lifecycleCallbacks: 
    prePersist: [ setOrderdatetimeValue ]

Ajatus\FoodcrmBundle\Entity\Orderdetails:
type: entity
table: orderDetails
repositoryClass: Ajatus\FoodcrmBundle\Repository\Orderdetails
fields:
    id:
        id: true
        type: integer
        unsigned: false
        nullable: false
        generator:
            strategy: IDENTITY
    quantity:
        type: integer
        nullable: false
        column: qunatity
    price:
        type: float
        nullable: true
        column: price
    total:
        type: float
        nullable: true
        column: total
    orderdate:
        type: datetime
        nullable: false
        column: orderDate
    iscancelled:
        type: boolean
        nullable: false
        column: isCancelled
    isdiscount:
        type: boolean
        nullable: false
        column: isDiscount
manyToOne:
    orderplacedid:
        targetEntity: Customerorder
        inversedBy: orderidlink
        joinColumn:
            name: orderid
            referencedColumnName: id
    menuitemid:
        targetEntity: Menuitems
        inversedBy: menuidlink
        joinColumn:
            name: menuid
            referencedColumnName: id
lifecycleCallbacks: 
    prePersist: [ setOrderdateValue ]   

当创建订单时,它应该在Customerorder中添加一行,并在orderdetails表中添加关于orderdetails的多行。

所以我需要一个表单来附加第一个客户端,然后是动态类型orderdetails。 有点像发票。

0 个答案:

没有答案