EntityLoadedEventFactory example

$eventDispatcher->addListener(EntityLoadedContainerEvent::classstatic function D$inner) use (&$event): void {
            $event = $inner;
        });

        $repo = new EntityRepository(
            $this->createMock(EntityDefinition::class),
            $reader,
            $this->createMock(VersionManager::class),
            $this->createMock(EntitySearcherInterface::class),
            $this->createMock(EntityAggregatorInterface::class),
            $eventDispatcher,
            new EntityLoadedEventFactory($this->createMock(DefinitionInstanceRegistry::class))
        );

        $criteria = new Criteria();
        $criteria->addFields(['foo']);
        $repo->search($criteria, Context::createDefaultContext());

        static::assertTrue(true);
        static::assertInstanceOf(EntityLoadedContainerEvent::class$event);

        $events = $event->getEvents();
        static::assertInstanceOf(NestedEventCollection::class$events);
        
Home | Imprint | This part of the site doesn't use cookies.