Problem/Motivation
Group module now have three diferent versions with important changes, 8.x-1.x will received secutiry fixes only and could be upgrade to 2.0.x.
In this moment Quick Node Clone only support 8.x-1.x and it is necessary to take and approach on how to manage with Group 2.0.x and 3.0.x in order to be compatible.
Group 2.x.0: https://www.drupal.org/project/group/releases/2.0.0-beta1
Group 3.x.0: https://www.drupal.org/project/group/releases/3.0.0-beta1
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3306677-12.patch | 4.53 KB | ricovandevin |
Issue fork quick_node_clone-3306677
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 #2
maxmendez commentedHere my first aproach to get compatibility between versions.
New architecture is this
TODO: Group 3.0.x Adapter.
Comment #3
thatguy commented@maxmendez any progress on the V3 adapter? If you need help, please provide the whole work you have done before since the patch file seems to miss the Group-folder.
Comment #4
thatguy commentedMade a quick patch that seems to work with Group dev-3.0.x version
Comment #5
thatguy commentedRemoved few unneeded use-statements I had added by mistake.
Comment #6
monaw commentedthanks @thatguy, i just tried your patch on my Drupal 9.5.2 and Group 3.1.0 and it fixed the problem (:
Comment #7
carroll_webprog commentedThanks @thatguy, Patch #5 also solved my issue.
Comment #8
kristiaanvandeneyndeThis only checks the access control by Group itself. Ideally, you check for access control on the group relationship entity type while providing the right bundle. Then, if another module implements the create access hook, that is also taken into account.
Comment #9
somebodysysop commentedSo, I am running quick node clone 8.x-1.16. If I want to install Group 2.x (coming from 1.x), so if I apply patch #5 I'm good.
But, what about this? https://www.drupal.org/project/quick_node_clone/issues/3306677#comment-1...
Does this need to be applied also, and if so, how?
Thanks!
Comment #10
ricovandevin commentedPatch #5 does not apply against Group 2.x. Patch #2 does not apply either and seems to be missing most of the code it should add. The approach in #3352168: Group module - Error: Class Drupal\group\Entity\GroupContent not found seems quite hacky. It seems that at this point there is no proper way to use Quick Node Clone with Group 2.x.
Comment #12
ricovandevin commentedThe MR aims to work for Group 2.x with backwards compatibility for Group 1.x (did not test it on 1.x). Not sure if it works for Group 3.x too. I think Group 3.x deserves it's own solution without BC for 1.x, maybe in a new major release for Quick Node Clone.
Comment #14
markdorisonThe changes in the MR look pretty good to be for providing support for 2.x along with backwards compatibility with 1.x, but I am a bit conflicted about how to continue to support the Group module effectively given these compatibility breaks and the ones in 3.x.
We could just cut a new major version release that drops Group 1.x/2.x support and adds support for 3 but it feel strange given that we don't have any hard dependencies on the group module. If we did, we could use semantic versioning to help us here, but then we would be forcing people to install the Group module when they may have no use for it.
I wonder if the right solution is to break this functionality into a sub-module (
quick_node_clone_group?) Are there any arguments against that path? If not, we could ship this MR and create a new issue to tackle the sub-module.Comment #15
somebodysysop commentedI'm not sure about this, but aren't the majority of people using the Group module using either 1.x or 2.x?
Comment #16
markdorisonAccording to the usage stats more people are using 3.x than 2.x, but both of those constituencies are growing with 1.x shrinking. The problem here is that without any kind of explicit requirement via semantic versioning the implication is that this module supports them all.
Comment #17
kristiaanvandeneyndePerhaps you could get away with an entity type definition check or a group version check?
This:
$group_contents = $this->entityTypeManager->getStorage('group_content')->loadByEntity($original_entity);would become something like:
Or:
I've not recommended something like the above before because it's usually cumbersome for Group-supporting modules to have to use that all over the place, but here it seems to be limited to one spot so it might just work.
Comment #18
kksandr commentedReroll of patch #5 for module version 1.17 (supports only version 3 of the group)
Comment #19
markdorisonPlease submit any changes via the current or a new merge request so that GitLabCI tests will run against it. Thank you!
Comment #21
kksandr commentedI've moved patch #18 to the merge request.
Comment #22
adriancotter commentedI just want to weigh in on the question of Group 2.0 and 3.0 support which didn't have a particularly clear answer above. Both 2.0 and 3.0 are currently supported Group versions and will be for some time -- or such is my understanding. I just updated from 1.0 to 2.0 for instance. The module page says:
Comment #23
markdorisonThis is a complicated problem to solve elegantly.
Given this, I am inclined to prioritize reviewing and merging support for 2.x (MR17) and then circle back to 3.x maybe with a new issue. All that to say, please review and provide feedback on MR 17.
Comment #24
kksandr commentedHaving looked at the group code, merge request #20 should work fine with groups 2 and 3.
The only difference between versions 2 and 3 is the machine name of the relationship entities: group_content -> group_relationship.
The group integration from #20 uses the
GroupRelationship(2, 3) class, thegroup_relation_type.manager(2, 3) service, and the group entity methodaddRelationship(2, 3). All of them are in versions 2 and 3. That is, the machine name is not used directly to load relationship entities.Comment #25
kksandr commentedI added support for group version 1 in merge request #20. That is, it now supports all versions of groups.
Does anyone have any ideas on how to cover this with tests? That is, run tests with different versions of groups.
Comment #26
markdorisonThank you @kksandr! In that case, I agree, let's turn our attention to MR 20.
Comment #27
markdorison@kksandr Thank you for your work on this, especially with the new tests! Do we need to add anything test-wise for Group v3?
Comment #28
kksandr commentedNo need. Testing version 3 occurs in the phpunit test by default, since the latest version itself is installed from the development dependencies.
Two (^1, ^2) additional runs of phpunit lower the version to 1 and 2, respectively.
I left a note about this in .gitlab-ci.yml
Comment #29
markdorison@kksandr Thanks for clarifying that. Fantastic!
Comment #30
markdorisonRebased and resolved conflicts.
Comment #32
markdorisonComment #34
shrikant.dhotre commentedHi @markdorison, can you please release this. MR.
Comment #35
markdorisonThanks for the bump. 8.x-1.18 has been released with this included.