Zeige Medienfassungen in der Verwaltung und halte Beschreibungen davon getrennt.
Eine Fassung bleibt nummeriert und kann deaktiviert werden. Beschreibung und fachliche Säulen gehören zum Medium und legen keine neue Fassung an. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
12f12117dd
commit
af85a94cd5
28 files changed
+1002
-168
No files matched your search
@@ -10,6 +10,8 @@
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionMember;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentResolver;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
@@ -317,6 +319,37 @@ public function compositionMembers(Composition $composition): array
|
||||
return $lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function memberPillars(Composition $composition): array
|
||||
{
|
||||
$version = $composition->versions()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->orderByDesc('number')
|
||||
->first();
|
||||
|
||||
if ($version === null) {
|
||||
return ['Noch keine Fassung, deshalb keine Säulen.'];
|
||||
}
|
||||
|
||||
$rows = app(ContentResolver::class)->expand($version);
|
||||
$versions = ContentElementVersion::query()
|
||||
->whereIn('id', array_column($rows, 'version_id'))
|
||||
->with('element.pillars')
|
||||
->get()
|
||||
->keyBy('id');
|
||||
$lines = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$element = $versions[$row['version_id']]->element;
|
||||
$names = $element->pillars->pluck('name');
|
||||
$lines[] = $element->working_title.' — '.($names->isEmpty() ? 'keiner Säule zugeordnet' : $names->join(', '));
|
||||
}
|
||||
|
||||
return $lines === [] ? ['Diese Fassung enthält keine Medien.'] : $lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user