$criteria->
addAssociation('crossSellings.assignedProducts'
);
/** @var ProductEntity $productA */
$productA =
$this->productRepository->
search($criteria, Context::
createDefaultContext())->
get('cf682b73be1afad47d0f32559ac34627'
);
/** @var ProductEntity $productB */
$productB =
$this->productRepository->
search($criteria, Context::
createDefaultContext())->
get('c9a70321b66449abb54ba9306ad02835'
);
static::
assertInstanceOf(ProductCrossSellingCollection::
class,
$productA->
getCrossSellings());
$aCrossSelling =
$productA->
getCrossSellings()->
first();
static::
assertInstanceOf(ProductCrossSellingEntity::
class,
$aCrossSelling);
static::
assertEquals('Lorem',
$aCrossSelling->
getName());
static::
assertInstanceOf(ProductCrossSellingAssignedProductsCollection::
class,
$aCrossSelling->
getAssignedProducts());
static::
assertCount(3,
$aCrossSelling->
getAssignedProducts());
static::
assertInstanceOf(ProductCrossSellingCollection::
class,
$productB->
getCrossSellings());
$bCrossSelling =
$productB->
getCrossSellings()->
first();
static::
assertInstanceOf(ProductCrossSellingEntity::
class,
$bCrossSelling);
static::
assertEquals('Ipsum',
$bCrossSelling->
getName());
static::
assertInstanceOf(ProductCrossSellingAssignedProductsCollection::
class,
$bCrossSelling->
getAssignedProducts());
static::
assertCount(3,
$bCrossSelling->
getAssignedProducts());
$progress =
$this->
export($context, ProductCrossSellingDefinition::ENTITY_NAME
);