Skip to content

Added a call to save to a storage on item update() - #30

Open
alexrayan wants to merge 5 commits into
moltin:masterfrom
alexrayan:master
Open

Added a call to save to a storage on item update()#30
alexrayan wants to merge 5 commits into
moltin:masterfrom
alexrayan:master

Conversation

@alexrayan

Copy link
Copy Markdown

Neither Cart::update($id, 'price', $price); nor Cart::item($id)->update('price',$price); triggers saving to a storage, therefore on next Cart construction the updates are lost.

I initially wanted to add another method to a storage save() which would call saveCart() protected method since with the above approach the following won't trigger update:

Cart::item($id)->price = $price;

But adding a $this->store->insertUpdate($this) within an Item object is better, since attribute value reassignment doesn't really tell us that the item has been updated and saved.

Regards,
Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant