namespace PatreonSync\Core\Content\PatreonLink; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\Context; class PatreonLinkRepository { private EntityRepository $repository; public function __construct(EntityRepository $repository) { $this->repository = $repository; } public function getByCustomerId(string $customerId, Context $context): ?PatreonLinkEntity { $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('customerId', $customerId)); return $this->repository->search($criteria, $context)->first(); } public function upsert(array $data, Context $context): void { $this->repository->upsert($data, $context); } }