ifNotActive example

/** * @param list<WriteCommand> $commands */
    private function executeCommands(array $commands, WriteContext $context): void
    {
        $entityDeleteEvent = EntityDeleteEvent::create($context$commands);
        $entityDeleteEventLegacy = BeforeDeleteEvent::create($context$commands);
        if ($entityDeleteEvent->filled()) {
            $this->eventDispatcher->dispatch($entityDeleteEvent);

            Feature::ifNotActive('v6.6.0.0', fn () => $this->eventDispatcher->dispatch($entityDeleteEventLegacy));
        }

        // throws exception on violation and then aborts/rollbacks this transaction         $event = new PreWriteValidationEvent($context$commands);
        $this->eventDispatcher->dispatch($event);
        /** @var list<WriteCommand> $commands */
        $commands = $event->getCommands();

        $this->generateChangeSets($commands);

        $context->getExceptions()->tryToThrow();

        
Home | Imprint | This part of the site doesn't use cookies.