Spin-off of #3382559: Deprecate the membership loader in favor of shared bundle classes for merely adding the concept of shared bundle classes.

Right now, Group creates a GroupRelationship bundle every time you install a plugin on a GroupType. This means that, if you were to use regular bundle classes, you'd end up with several classes representing the concept of a group membership, a grouped article or what have you. To improve DX, we want to introduce a concept where one class can be shared among all bundles for a given plugin.

The system will be compatible with regular bundle classes, not interfering with them if they exist. The logic is as follows:

  • No shared bundle class, no bundle class: Entity is instance of GroupRelationship
  • No shared bundle class, bundle class: Entity is instance of the bundle class
  • Shared bundle class, no bundle class: Entity is instance of the shared bundle class
  • Shared bundle class, bundle class: Entity is instance of the bundle class

To make it so people can easily create a regular bundle class, you should put all of your shared bundle class functionality in an interface and trait. Then the individual bundle class is not required to extend your shared bundle class, but can easily opt in to your interface by using the trait.

Issue fork group-3382831

Command icon 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

kristiaanvandeneynde created an issue. See original summary.

kristiaanvandeneynde’s picture

Status: Active » Needs review

Added the code from the other issue, will add tests here.

kristiaanvandeneynde’s picture

Version: 3.1.x-dev » 2.1.x-dev

Merged, now let's move to 2.1.x

kristiaanvandeneynde’s picture

Status: Needs review » Fixed
kristiaanvandeneynde’s picture

Issue tags: +Needs change record
kristiaanvandeneynde’s picture

Issue tags: -Needs change record

Added CR

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.