- Issue created by @rsnyd
- @c_archer opened merge request.
- Status changed to Needs review
over 1 year ago 2:03pm 26 June 2023 - Status changed to Needs work
over 1 year ago 11:26am 6 July 2023 - 🇮🇱Israel jsacksick
So, this patch is not really correct as it should also drop D8 compatibility.
Symfony\Contracts\EventDispatcher\Event;
doesn't exist on D8 since it's provided by thesymfony/event-dispatcher-contracts
package with is a dependency starting Drupal 9. So this patch should drop D8 compatibility.
After this, 📌 Update core_version_requirement in .info file. Closed: duplicate can probably marked as a duplicate.Also you might want instead to use the bridge event class provided by Drupal core (See https://www.drupal.org/node/3159012 → for explanations).
- 🇮🇱Israel jsacksick
Also, I'm pretty sure the tests themselves have to be updated to run on D10.
- 🇺🇸United States rsnyd
@jsacksick,
Thank you for the helpful feedback. So I've changed the .info.yml file to drop the D8 compatability. ShipStationOrderExportedEvent now uses Drupal\Component\EventDispatcher\Event.These two changes are included in the patch.
As for the tests, there is really only one that ShipStationKernelTestBase is the only class that contains real tests, i.e. not just stubs/function signatures. This test only references commerce_order, commerce_shipping, commerce_product and profile packages, so I don't think there's anything to do to get it to run on D10. The root composer.json, however, requires "drupal/commerce": "^2.17" and "drupal/commerce_shipping": "^2.1". Do these versions need to be updated to "drupal/commerce": "^2.36" and/or "drupal/commerce_shipping": "^2.6"?
Thank you for the help.
- Status changed to Needs review
over 1 year ago 6:57am 7 July 2023 - 🇮🇱Israel jsacksick
Oh... I see the tests are just useless (just checked the code), there's an additional change required to properly support D10. In the link I sent, it is explained that the order of parameters changed when calling the dispatch() method on the event dispatcher.
Also, the bridge class has been introduced in Drupal core 9.1 (it is technically not there in 9.0).
Note that the patch you sent isn't applicable as is (it shouldn't be generated from the drupal root but you rather need to clone the module's repo, make your changes and then use the git diff command (See https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa... → ).
Also had a quick look at the module in general and as far as I can see there are several coding standard issues, fixing these is probably not in the scope of this issue though... There's code commented out, calls to \Drupal:: from within services rather than using dependency injection (e.g:
\Drupal::moduleHandler()->alter('commerce_shipstation_order_xml')
from ShipStation.php rather than$this->moduleHandler
- 🇬🇧United Kingdom c_archer Cumbria
Lets create a ticket for the coding standards and I'm happy to pick up.
- 🇺🇸United States rsnyd
@jsacksick,
Ok, my changes include the following:- core_version_requirement in info.yml to be ^9.1 || ^10
- use statement in ShipStationOrderExportedEvent to use bridge class
- Type hints in ShipStation to use \Symfony\Contracts\EventDispatcher\EventDispatcherInterface (from your link, NOTE: I did not change the use statement to match since the link only specifically mentions the type hints and "Since Symfony 4.3, Symfony\Component\EventDispatcher\EventDispatcherInterface extends Symfony\Contracts\EventDispatcher\EventDispatcherInterface")
- I have created the patch from the commerce_shipstation cloned repository folder this time
- I have not touched the coding standards or the addressed the dependency injection issues since I'm just trying to get my first patch accepted and I figure simpler is better. Happy to address these in another issue, but I see that @c_archer has already volunteered
I hope this one is correct. Thank you for taking the time to help me.
- 🇮🇱Israel jsacksick
The event dispatcher parameter change isn't present in your patch (see my patch), this breaks in D10.
- 🇺🇸United States rsnyd
@jsacksick,
So sorry, I'm not sure how that happened.Thank you again.
- First commit to issue fork.
- @rwanth opened merge request.
-
rwanth →
committed 4aa8dbf0 on 2.x
Issue #3363000 by rsnyd, jsacksick, c_archer: Drupal 10 Compatibility
-
rwanth →
committed 4aa8dbf0 on 2.x
- Status changed to Fixed
over 1 year ago 2:05pm 1 August 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 12:03pm 20 November 2023