Quellübung mit stabiler Kennung und Inhaltswert, genau ein Stand je Prüfsumme, bewusste Übernahme als neue lokale Fassung, lokale Ergänzungen bleiben erhalten, Ausblenden an der Quelle setzt nur die Verfügbarkeit. Seite Übernahme (Shinkan), Feldzuordnung, ADR-49 (inklusive Abweichung bei der Mediensperre), Abnahmestand und Rückfallverfahren. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Catalog;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Durchführungsvariante einer Übungsfassung. Der Schlüssel ist je Fassung eindeutig und bleibt über Fassungen hinweg
|
|
* gleich, damit eine Auswahl im Modul oder Programm und der Abgleich mit einer Quelle dieselbe Variante meinen.
|
|
* Wie die Mitglieder ist sie nur im Entwurf der Fassung schreibbar.
|
|
*/
|
|
class CompositionVersionVariant extends Model
|
|
{
|
|
protected $fillable = ['composition_version_id', 'key', 'position', 'name', 'description', 'origin'];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(function (CompositionVersionVariant $variant): void {
|
|
$status = CompositionVersion::query()->whereKey($variant->composition_version_id)->value('status');
|
|
|
|
if (StatusValue::of($status) === ContentVersionStatus::Bereit->value) {
|
|
throw new DomainRuleException('Eine bestätigte Kompositionsfassung nimmt keine weiteren Varianten auf.');
|
|
}
|
|
});
|
|
|
|
static::updating(function (): void {
|
|
throw new DomainRuleException('Varianten einer Komposition werden nicht verändert, sondern durch eine neue Fassung ersetzt.');
|
|
});
|
|
}
|
|
|
|
public function compositionVersion(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CompositionVersion::class);
|
|
}
|
|
}
|