# getShopContext() für shop mit ID in backend module

**URL:** <https://forum.shopware.com/t/getshopcontext-fur-shop-mit-id-in-backend-module/47510>\
**Category:** Programmierung\
**Created:** [11. August 2017 um 14:49 UTC](https://forum.shopware.com/t/getshopcontext-fur-shop-mit-id-in-backend-module/47510 "2017-08-11T14:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flynorc](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@flynorc](https://forum.shopware.com/u/flynorc)\
**Post date:** [11. August 2017 um 14:49 UTC](https://forum.shopware.com/t/getshopcontext-fur-shop-mit-id-in-backend-module/47510/1 "2017-08-11T14:49:14Z")

</div>

Hallo,

Wenn ich in frontend controller context von shop brauche, mache ich so was:&nbsp;

```
$this->get('shopware_storefront.context_service')->getShopContext();

```

Ich versuche shop context zu kriegen in backend jetzt so

```
$repository = Shopware()->Container()->get('models')->getRepository('Shopware\Models\Shop\Shop');
$shop = $repository->getActiveById(1);

```

Wie kann ich von $shop zum context kommen?

Danke!

---

<div class="post-metadata">

**Author:** ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)\
**Post date:** [12. August 2017 um 16:12 UTC](https://forum.shopware.com/t/getshopcontext-fur-shop-mit-id-in-backend-module/47510/2 "2017-08-12T16:12:14Z")

</div>

Hallo flynorc,

das würde mit&nbsp;

```
$shopContext = $this->get('shopware_storefront.context_service')->createShopContext($shopId);
// in deinem Fall wäre $shopId = 1

```

gehen. So macht das Shopware im [Backend-Bestellungen Plugin](https://github.com/shopwareLabs/SwagBackendOrder/blob/master/Controllers/Backend/SwagBackendOrder.php#L158) auch.

Viele Grüße
