Problem. orchestra_content binds a process instance to one content entity via the orchestra_attachment side entity. The resolution API (AttachmentManager::attachmentFor() / entityFor()) returns a single attachment and nothing can address more than one, so a run can be "about" only one entity. A workflow that legitimately concerns several entities (for example an order plus its customer and its invoice) cannot bind them all as first-class, reverse-lookupable, task-targetable subjects. The storage even allows several rows per instance today (no unique constraint, attach() does not dedupe), but attachmentFor() resolves one arbitrarily, so extra attachments are storable yet unusable.

Proposed solution. Make attachments keyed, so an instance can bind several entities under distinct keys (roles), each addressable, while the default (empty) key behaves as today's single subject.

  • Add a "key" field to orchestra_attachment (default empty = the primary subject).
  • One attachment per (instance, key): attach() with a key is update-or-create for that key; a different key coexists.
  • API: attach($instance, $entity, $key), attachmentFor($instance, $key), entityFor($instance, $key), attachmentsFor($instance) and entitiesFor($instance) keyed by key, instancesFor($entity, $key).
  • Consumers pick which: the "target: attached" action and the content-bound task types take an optional attachment key (default = primary).

Backwards compatibility. The default empty key is the current single subject, so existing workflows and the action keep working. Pre-1.0, the new field rides a fresh install (no update hook); the live site is patched by hand.

Issue fork orchestra-3605318

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

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed c44a63cf on 1.x
    feat: #3605318 Allow a process instance to be attached to multiple...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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