Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderItemsTaxesApplicator breaks when items are removed #259

Closed
aleho opened this issue Mar 2, 2021 · 0 comments · Fixed by #260
Closed

OrderItemsTaxesApplicator breaks when items are removed #259

aleho opened this issue Mar 2, 2021 · 0 comments · Fixed by #260

Comments

@aleho
Copy link
Contributor

aleho commented Mar 2, 2021

When items are removed from a Doctrine ArrayCollection, the indexes leave holes.

OrderItemsTaxesApplicator iterates over the items using an index, causing access to unset array keys:

foreach ($item->getUnits() as $index => $unit) {

A simple fix would be to either use $item->getUnits()->getValues() or (less elegant) use a counter variable as seen in Sylius 1.9.

This is critical in my opinion, as it breaks all setups with RefundPlugin, so possibly also Plus.

GSadee added a commit that referenced this issue Mar 4, 2021
This PR was merged into the 1.0-dev branch.

Discussion
----------

This fixes an undefined offset error caused by holes in ArrayCollection keys after removing units.

Fixes #259

Commits
-------

97245d7 Fix OrderItemsTaxesApplicator with removed units
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant