- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Core\Events;
|
|
|
|
use App\Framework\Core\AttributeCompiler;
|
|
|
|
/**
|
|
* Compiler für Event-Handler
|
|
*/
|
|
final class EventHandlerCompiler implements AttributeCompiler
|
|
{
|
|
/**
|
|
* Gibt die Attributklasse zurück, die dieser Compiler verarbeitet
|
|
*/
|
|
public function getAttributeClass(): string
|
|
{
|
|
return OnEvent::class;
|
|
}
|
|
|
|
/**
|
|
* Kompiliert die Event-Handler
|
|
*
|
|
* @param array $attributeData Array mit Attributdaten aus dem Mapper
|
|
* @return array Kompilierte Event-Handler
|
|
*/
|
|
public function compile(array $attributeData): array
|
|
{
|
|
// Sortieren nach Priorität (höhere Werte zuerst)
|
|
usort($attributeData, function ($a, $b) {
|
|
$priorityA = $a['attribute']->priority ?? 0;
|
|
$priorityB = $b['attribute']->priority ?? 0;
|
|
|
|
return $priorityB <=> $priorityA;
|
|
});
|
|
|
|
// Weitere Kompilierung wenn nötig (z.B. Validierung)
|
|
|
|
return $attributeData;
|
|
}
|
|
}
|