embedRelation()(sfPropel15Plugin)是否适用于多对多关系?

时间:2011-01-18 17:26:28

标签: symfony1 propel

embedRelation()(sfPropel15Plugin)适用于多对多 关系?如果没有任何经验或教程,那么(嵌入 m:m关系的形式)?

此致

Javi

1 个答案:

答案 0 :(得分:1)

的schema.yml

product:
    id:           ~
    name:         {type: varchar(255), required: true}
    price:        {type: integer, required: true}

  order_list:
    id:           ~
    order_id:     {type: integer, required: true, foreignTable: order, foreignReference: id, onDelete: cascade, onUpdate: cascade}
    product_id:   {type: integer, required: true, foreignTable: product, foreignReference: id, onDelete: cascade, onUpdate: cascade}

  order:
    id:           ~
    name:         {type: varchar(255), required: true}

班级形式:

class OrderForm extends BaseOrderForm
{
  public function configure()
  {
      $this->embedRelation('OrderList');
  }
}

添加它看起来像:

enter image description here