vendor/codefog/contao-haste/src/EventListener/DcaRelationsListener.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Codefog\HasteBundle\EventListener;
  4. use Codefog\HasteBundle\DcaRelationsManager;
  5. use Codefog\HasteBundle\Event\UndoEvent;
  6. use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
  7. use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
  8. class DcaRelationsListener
  9. {
  10.     public function __construct(private readonly DcaRelationsManager $dcaRelations,)
  11.     {
  12.     }
  13.     #[AsEventListener]
  14.     public function onUndo(UndoEvent $event): void
  15.     {
  16.         $this->dcaRelations->undoRelations($event->getHasteData(), $event->getId(), $event->getTable(), $event->getRow());
  17.     }
  18.     #[AsEventListener]
  19.     public function postGenerateSchema(GenerateSchemaEventArgs $event): void
  20.     {
  21.         $this->dcaRelations->appendToSchema($event->getSchema());
  22.     }
  23. }