shopware5 / SwagPaymentPaypal

A PayPal integration for shopware
http://shopware.com
MIT License
5 stars 16 forks source link

Improve update support starting the update with versions at or below 3.1.0 #8

Closed mihovil-bubnjar closed 6 years ago

mihovil-bubnjar commented 8 years ago

While updating one clients shop and leading an unsatisfactory discussion with the Shopware support team i've decided to share my solution for this minimal problem thus making the "we will not support this fixed plugin" statement moot.

Basically you only missed checking whether the menu item has already been created previously so any version equal to or below 3.1.0 tries to create an already existing menu item (causing the update to crash at this line of code beacuse of database restrictions). When fixed with this pull request, the menu item is loaded from the database and is only modified and saved.

I've modified the createMyMenu function to take this into account and only modify the record instead of creating a new one. This modification has been tested on my side using a cleanly installed 4.2.3 Shop, installing the Paypal Plugin Version 2.1.7 (which has been active on my clients shop), running the update to 5.1.6 and updating the plugin afterwards.

Also included are minor type hints for PhpStorm to not have hiccups on return types.

shopwareBot commented 8 years ago

Hello,

thank you for creating this pull request. I have opened an issue on our Issue Tracker for you. See the issue link: https://issues.shopware.com/issues/PT-6964.

Please use this issue to track the state of your pull request.

mitelg commented 6 years ago

due to time constraints, we decided to close this PR. If this is still an issue for you, feel free to open an new PR :blush: :+1: