Skip to content

LinkRepository #114

@derpixler

Description

@derpixler

API Reference: Ticket Links

Links objects (typically tickets) to each other. Three link types exist: normal (standard), parent (blocks), child (blocked by).

Methods:

Method HTTP Endpoint
list(string $objectType, int $objectId) GET links?link_object={type}&link_object_value={id}
add(string $type, string $sourceType, int $sourceId, string $targetType, int $targetId) POST links/add
remove(string $type, string $sourceType, int $sourceId, string $targetType, int $targetId) DELETE links/remove?link_type=...&link_object_source=...&link_object_source_value=...&link_object_target=...&link_object_target_value=...

No find($id) — links use composite identifiers, not a single numeric ID. No create()/update()/patch() — links are atomic add/remove operations. No all() — always scoped to a specific object type and ID. delete() is not standard CRUD — calls remove() instead.

Acceptance Criteria

  • php -l + phpcs PSR-12 clean
  • list('Ticket', 42) returns PaginatedList<LinkDTO>
  • add('normal', 'Ticket', 1, 'Ticket', 2) POSTs link
  • remove('parent', 'Ticket', 1, 'Ticket', 2) DELETEs link
  • Extends AbstractRepository where applicable, overrides methods that don't fit the composite-key model
  • getListKey() returns 'links'
  • Testing: LinkRepositoryTest — list('Ticket', 1), add normal link between two tickets, remove link
  • Documentation in README: README — ticket linking add/remove example

Depends on

Produces

  • LinkRepository

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions