Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Make Commerce Stock module and submodules Drupal 10 compatible
Create a patch with core_version_requirement modified and rector suggested changes.
Comment | File | Size | Author |
---|---|---|---|
#17 | commerce-stock-d10-compat-3330022-17.patch | 25.25 KB | NicklasMF |
#8 | commerce-stock-d10-compat-3330022-8.patch | 25.32 KB | SilviuChingaru |
Issue fork commerce_stock-3330022
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
RgnYLDZ CreditAttribution: RgnYLDZ commentedAny updates on this? Is there a dev version we can test and give feedback ?
Comment #4
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commented@RgnYLDZ you can apply the patch against current dev version and review it. You can even clone the 3330022-drupal-10-compatibility branch.
Thank you for your interest!
Comment #5
guy_schneerson CreditAttribution: guy_schneerson commentedThanks, @silviuchingaru I was expecting the Event stuff and could not think of anything else that should cause an issue so I suspect you got it spot on :)
Comment #6
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commented@guy_schneerson you are welcomed but I think that the patch is not ready because it uses event from Symfony 6 and is marked as compatible with Drupal 8 which is not the case because Symfony 6 was implemented in Drupal > 9.0.
I think we should use it like Commerce does to make it also backward compatible.
I'll update merge request soon with this.
Comment #7
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedFixed all tests (error and deprecation)!
After this commit, the output of run-tests.sh is:
Comment #8
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedPatch to add a test.
Comment #9
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedAgainst D10 I had tested locally and all pass, after commit, we'll have a dev release for composer to install and test further, D9.x has some deprecated functions that won't pass against PHP 8.1, It's a known issue, but all should pass also from 7.3 to 8.0.
I think this is ready for commit now.
Comment #10
NicklasMF CreditAttribution: NicklasMF as a volunteer commentedI'm getting the following .rej error file when trying to apply the patch to Drupal 9.5.3:
I am running a D10 site but couldn't install the module and the patch at the same time, so I downgraded to D9.5 and then installed commerce_stock. After this, I tried to apply the patch but got the error above.
Can you confirm that the patch still works for you, and if so, can you elaborate on how I can test the patch?
Comment #11
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedI queued a test agains Drupal 9.5.2, let's see if it passes.
Meanwhile please post the content of.rej file.
Comment #12
NicklasMF CreditAttribution: NicklasMF as a volunteer commentedSorry, if it was not clear enough in my post. The code in the grey box is the .rej file.
Comment #13
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedCan you post exact commands and their output of how you try to patch, please?
Comment #14
guy_schneerson CreditAttribution: guy_schneerson commented@NicklasMF thank you for your hard work on this.
I Tested on 10.0.3 with commerce 2.33 and all worked so far.
I have not had a chance to test with 9 and I can see how Symfony 6 events may be an issue although it looks like Symfony 5 has an Event class that provides a forward-compatibility layer so maybe it will just work.
Comment #15
NicklasMF CreditAttribution: NicklasMF as a volunteer commentedSure. I have following in composer.json:
I then add the following:
And run
composer update drupal/commerce_stock
in console.I get following error:
And the file commerce_stock_field.info.yml.rejis created:
Comment #16
SilviuChingaru CreditAttribution: SilviuChingaru at MagazinulCuScule.ro for MagazinulCuScule.ro commentedCan you try also, please, with:
Thank you!
Comment #17
NicklasMF CreditAttribution: NicklasMF as a volunteer commentedI don't know why that didn't work neither.
I tried some things back and forth and finally got it to work. I removed one line in the start and added a new line after the specific file.
From line 76:
I'll just add the patch in case it is useful.
And then I'll go test the patch now.
Comment #18
AlfTheCat CreditAttribution: AlfTheCat commentedLatest patch applied cleanly, so far it all seems to work.
Comment #20
SoCalErich CreditAttribution: SoCalErich as a volunteer commentedSo how do we install this with Drupal 10 then?
I added this to my patches section in composer.json:
but if I do composer require drupal/commerce_stock, I get
Doesn't the patch get run AFTER composer downloading the files?
Comment #22
guy_schneerson CreditAttribution: guy_schneerson commentedAfter testing on both 9 and 10 I committed SilviuChingaru patch commerce-stock-d10-compat-3330022-8.patch
I assume we will still fail tests and we will need a second commit but thought it best to have a dev version with 10 support to work and test on.
Will look at the other proposed changes wen I can.
Comment #23
agoradesign CreditAttribution: agoradesign commentedis there anything left do do? this is the last important blocker for our commerce sites to upgrade to 10.x
Comment #24
guy_schneerson CreditAttribution: guy_schneerson commented@agoradesign should be good to go. Dev version should be all fine if you can give that a go and confirm that will help.
I am away until Thursday and can push a version then.
Comment #25
agoradesign CreditAttribution: agoradesign commentedActually I do have the dev installed on 3 10.x sites. No problems so far, but I have to mention that two of them are stell under development and the third one is live though, but not under heavy traffic :D
Anyway, we had one or two orders there since then, as well as saving stock changes via migrate import did not cause any errors as well
Comment #26
guy_schneerson CreditAttribution: guy_schneerson commentedA big thank you to everyone that helped with this. I just pushed 8.x-1.1 and marked the issue as fixed. If anyone gets any issues specific to D10 then please reopen.