Repeater deletes the record instead of updating it
Hello, i have a repeater like this, the repeater is too long i'll just paste the essential lines
the problem occurs inside
CheckinResource::calculateActualPrices
, below is the code of this method
as you can see, i'm iterating through the repeater records, i calculate the actual_quantity_price, then add that changed record to a new list. then i assign that new list to the repeater.
this causes the repeater to delete all the records and creating new ones, i know this is kinda expected to happen. but i was wondering, is there like a primary key (using the id inside $product variable) that i can assign to each repeater, so instead of deleting and creating, it updates the record based on the $product's id. thanks for any suggestions!5 Replies
This is relationship type dependant. It deletes usually because it doesn't know which record should exist withoud an ID. What type of relationship are you using?
but the octaneStockProduct relationship has an id, this is my relationship
That’s fine, but if you look at the code I provided it included the id in the name which will return the integer opposed to returning the array of integers / values.
could you please elaborate? i don't get what you mean
How about? Just some guessing, but the key might be needed.