GenreService, ArtistService, ArtistEngagementService (state machine), StageService, StageDayService, PerformanceService, LaneCascadeService under app/Services/Artist/. Plain final classes with constructor injection — matches FormSubmissionService convention. ArtistEngagementService implements the RFC §10.1 booking_status state machine: terminal Cancelled/Rejected/Declined, Option requires future option_expires_at, Contracted requires fee_amount > 0. transitionStatus is the focused entry point; update() routes through it whenever the payload mutates booking_status. cancel() composes transitionStatus + soft delete in one transaction so the existing ArtistEngagementObserver cascade fires. LaneCascadeService is the D18 transactional move algorithm. Locks the dragged Performance row FOR UPDATE, validates client version against the persisted version (D14), then either parks (stage_id=null, no cascade) or places onto (stage, event, lane) with single-level cascade-bump of any time-overlapping rows on the target lane. Returns a MoveResult value object carrying the moved + cascaded performances so the controller maps them to API resources without a second query. StageDayService implements the §10.5 atomic matrix replace. Detects non-cancelled performances on event_ids about to be removed; throws StageDaysOrphanedPerformancesException unless force_orphan=true. The orphans are not deleted — they persist with the same stage_id so they re-appear when the day re-activates (D5/D27 retention). ArtistService.create raises DuplicateArtistException carrying the existing master so the controller can offer a "use existing" choice instead of forcing the booker to abandon their dialog. ArtistEngagement defaults buma_handled_by based on artist.agent_company.handles_buma per RFC D26. GenreService.delete is hard-blocked (GenreInUseException) when artists still reference the genre via default_genre_id; the frontend rebinds those artists first. StageService.delete cascade-parks performances (stage_id → null, lane preserved) and returns the parked count for the activity-log entry the controller writes in Step 9. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
756 B
PHP
28 lines
756 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Exceptions\Artist;
|
|
|
|
use DomainException;
|
|
|
|
/**
|
|
* Raised by LaneCascadeService::move when the client-supplied version
|
|
* does not match the row's current version (RFC v0.2 D14 — optimistic
|
|
* locking on Performance). Controller maps to HTTP 409 with body
|
|
* `{conflict: 'version_mismatch', current_version: N, server_data: …}`.
|
|
*/
|
|
final class VersionMismatchException extends DomainException
|
|
{
|
|
public function __construct(
|
|
public readonly int $currentVersion,
|
|
public readonly int $clientVersion,
|
|
) {
|
|
parent::__construct(sprintf(
|
|
'Performance version mismatch: server=%d, client=%d.',
|
|
$currentVersion,
|
|
$clientVersion,
|
|
));
|
|
}
|
|
}
|