<?php
declare(strict_types=1);
namespace NetInventors\NetiNextEasyCouponDesigns\Decorator;
use Shopware\Core\Framework\DataAbstractionLayer\Search\AggregationResult\AggregationResultCollection;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult;
use Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult;
use Shopware\Core\System\SalesChannel\Entity\SalesChannelRepositoryInterface;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
class EasyCouponProductRepositoryDecorator implements SalesChannelRepositoryInterface
{
protected SalesChannelRepositoryInterface $repository;
public function __construct(
SalesChannelRepositoryInterface $repository
) {
$this->repository = $repository;
}
public function aggregate(Criteria $criteria, SalesChannelContext $salesChannelContext): AggregationResultCollection
{
return $this->repository->aggregate($criteria, $salesChannelContext);
}
public function searchIds(Criteria $criteria, SalesChannelContext $salesChannelContext): IdSearchResult
{
return $this->repository->searchIds($criteria, $salesChannelContext);
}
public function search(Criteria $criteria, SalesChannelContext $salesChannelContext): EntitySearchResult
{
$criteria->addAssociation('netiEasyCouponProduct.netiEasyCouponDesigns.variants.types');
$criteria->addAssociation('netiEasyCouponProduct.netiEasyCouponDesigns.variants.pages');
$criteria->addAssociation('netiEasyCouponProduct.netiEasyCouponDesigns.variants.translations.media.thumbnails');
$result = $this->repository->search($criteria, $salesChannelContext);
return $result;
}
}