EntityWriteGateway example

$errorSpy = $this->callbackSpy();

        $spy = $this->eventListenerCalledSpy(function DEntityDeleteEvent $event) use ($successSpy$errorSpy): void {
            $event->addSuccess($successSpy(...));
            $event->addError($errorSpy(...));
        });

        $this->getContainer()->get('event_dispatcher')->addListener($eventClass$spy);

        $definitionRegistry = $this->getContainer()->get(DefinitionInstanceRegistry::class);

        $gateway = new EntityWriteGateway(
            1,
            $connection,
            $this->getContainer()->get('event_dispatcher'),
            $this->getContainer()->get(ExceptionHandlerRegistry::class),
            $definitionRegistry
        );

        $writeContext = WriteContext::createFromContext(Context::createDefaultContext());

        $command = new DeleteCommand(
            $definitionRegistry->getByEntityName('product'),
            
Home | Imprint | This part of the site doesn't use cookies.