X
X
xbox2016-08-22 16:23:54
symfony
xbox, 2016-08-22 16:23:54

How to create a subform in Symfony 1.2 in the admin panel (on the Orders page, show the list of products)?

Greetings.
There is an online store written in the old Symfony 1.2 framework.
Site users can create orders. On the user side, everything works fine.
I want to add the ability to edit orders in the admin panel. So that you can change the number of selected goods in orders, their price, as well as delete and add positions.
In the database, the fields are stored in two tables: "orders" - orders, "order_position" - ordered goods.
Scheme below:

orders:
    _attributes: { phpName: Order }
    id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true }
    user_id:     { type: integer, foreignTable: user, foreignReference: id, onDelete: setNull }
    guest_id:    { type: integer, foreignTable: guest, foreignReference: id, onDelete: setNull }
    cost:        { type: decimal, size: 9, scale: 2 }
    comments:    { type: longvarchar }
    action:      { type: varchar(255) }    
    created_at:        

  order_position:
    id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true }
    order_id:    { type: integer, foreignTable: orders, foreignReference: id, onDelete: cascade }
    item_id:     { type: integer, foreignTable: catalog_item, foreignReference: id, onDelete: setNull }
    quantity:    { type: decimal, size: 9, scale: 2 }
    cost:        { type: decimal, size: 9, scale: 2 }

I know how to create a simple page in the admin panel for working with one table (in this case, "orders").
But with this implementation, I can see and edit a minimum of fields. The main thing is that it is not possible to see and edit the products in the order (from the related order_position table).
How can I connect the output of goods on the order editing page in the admin panel?
Those. most likely in the admin panel on the order editing page, you need to somehow add a subordinate page.
In general, for the admin panel, I create all the pages with a generator and then, if necessary, change the composition of the displayed fields or edit the generated form.
So far I have not done complex non-standard pages for the admin panel. So now I don't know how to approach the solution of the problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question