Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Cortex save model and hasmany relation

25 views
Skip to first unread message

BQ VOR

unread,
Apr 15, 2024, 11:04:28 AM4/15/24
to Fat-Free Framework
Hi Everyone,

i use Cortex as ORM and with that the ->copyfrom method. I have an order model with an hasmany relation to orderlines. The edit form is working and the orderlines are nice available when we access the order model. From this screen i would like to save the orderlines also, this means;

1) the orderlines which are deleted should be removed from the table
2) the orderlines with changed quantity must be updated in table
3) new orderlines will be available to add on-the-fly in the GUI, which means these need an insert in relation to the order model

I think 1 and 2 should be the easiest, i already have my form done and the order model data is updated via Cortex ->copyfrom. I would like to start bij updating the related orderlines first. How can i do this via ->copyfrom? Do i need to structure the POST'ed data so Cortex understands its getting multiple instances of the hadmany relation?

When i get a grip on this i think i can manage 2. 3 will be a different issue all together is assume.

Hope someone can help me with the ->copyfrom issue first. Thanks in advance.
Reply all
Reply to author
Forward
0 new messages