$criteria =
new Criteria();
$criteria->
addAssociations([ 'manufacturer',
'prices',
'categories',
]);
/** @var ProductEntity $product */
$product =
$this->productRepository->
search($criteria, Context::
createDefaultContext())->
first();
$product->
addExtension('test',
new LanguageCollection([ (new LanguageEntity())->
assign(['id' =>
$this->ids->
create('l1'
), '_entityName' => 'language'
]),
]));
$events =
$this->entityLoadedEventFactory->
create([$product], Context::
createDefaultContext());
$createdEvents =
$events->
getEvents()->
map(fn (EntityLoadedEvent
$event): string =>
$event->
getName());
sort($createdEvents);
static::
assertEquals([ 'category.loaded',
'language.loaded',
'product.loaded',
'product_manufacturer.loaded',