OrganisationObserver was gated on app()->runningUnitTests() — replaced
with config('artist_advance.bootstrap_on_org_create') (default true,
phpunit.xml overrides to false). Behaviour identical, but the seam is
explicit and removable. Tracked for full convergence by new BACKLOG
entry TECH-OBSERVER-TEST-CONVERGENCE — productiegedrag = testgedrag,
geen branching, na test-cleanup.
idempotency_key for the engagement-scoped draft simplified from
'aa-' + sha1(engagement_id)[0:27] to 'aa:' + engagement_id (29 chars,
fits varchar(30)). Same uniqueness guarantee, recognisable shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\FormBuilder\Defaults\ArtistAdvanceDefault;
|
|
use App\Models\Organisation;
|
|
|
|
/**
|
|
* Bootstrap an organisation's domain defaults on creation.
|
|
*
|
|
* Currently provisions the artist_advance FormSchema (RFC-TIMETABLE
|
|
* v0.2 D15) so new tenants can use the artist portal flow without a
|
|
* separate manual step. Existing organisations get the same coverage
|
|
* via the `artist:seed-advance-default` artisan command.
|
|
*
|
|
* The default seeder is idempotent — if the org already owns an
|
|
* artist_advance schema, the call is a no-op. Safe to re-run.
|
|
*
|
|
* Gated by `config('artist_advance.bootstrap_on_org_create')`. The
|
|
* config defaults to true (production behaviour); phpunit.xml flips
|
|
* it to false so existing FormSchema-counting tests aren't perturbed.
|
|
* Tests that need the auto-seed call `ArtistAdvanceDefault::seedFor()`
|
|
* explicitly. Tracked for removal by BACKLOG entry
|
|
* `TECH-OBSERVER-TEST-CONVERGENCE`.
|
|
*/
|
|
final class OrganisationObserver
|
|
{
|
|
public function created(Organisation $organisation): void
|
|
{
|
|
if (! (bool) config('artist_advance.bootstrap_on_org_create', true)) {
|
|
return;
|
|
}
|
|
|
|
ArtistAdvanceDefault::seedFor($organisation);
|
|
}
|
|
}
|