# Referenz auf Context von SalesChannelEntity

**URL:** <https://forum.shopware.com/t/referenz-auf-context-von-saleschannelentity/87233>\
**Category:** Programmierung\
**Created:** [28. April 2021 um 13:31 UTC](https://forum.shopware.com/t/referenz-auf-context-von-saleschannelentity/87233 "2021-04-28T13:31:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_MikeB](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/_mikeb/32/7856_2.png) [@\_MikeB](https://forum.shopware.com/u/_MikeB)\
**Post date:** [28. April 2021 um 13:31 UTC](https://forum.shopware.com/t/referenz-auf-context-von-saleschannelentity/87233/1 "2021-04-28T13:31:32Z")

</div>

Hi.

In der Regel ermittle ich mir anhand des SalesChannelContext den SalesChannel. Ich bräuchte es aber genau anders rum. Ich habe den SalesChannel aber benötigen den Context um das Produkt Repo abzufragen. Wie schaffe ich das?

```
private function getExportProducts(SalesChannelEntity $salesChannel)
{
	$criteria = $this->getProductsCriteria($salesChannel);
$products = $this->productRepository->search($criteria, Context::createDefaultContext())->getEntities();

return $products;
}

```

Gruß Mike
