# ComponentHandlerInterface service abfrage

**URL:** <https://forum.shopware.com/t/componenthandlerinterface-service-abfrage/62181>\
**Category:** Programmierung\
**Created:** [7. Oktober 2019 um 08:38 UTC](https://forum.shopware.com/t/componenthandlerinterface-service-abfrage/62181 "2019-10-07T08:38:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)\
**Post date:** [7. Oktober 2019 um 08:38 UTC](https://forum.shopware.com/t/componenthandlerinterface-service-abfrage/62181/1 "2019-10-07T08:38:52Z")

</div>

in shopware plugin haupt php datei können wir ja unsere service&nbsp;so bekommen:

```
$mein_service = $this->container->get("mein_service");

```

aber in eine einkaufswelt plugin ding gibts keine `$this->container?`  
[Custom shopping world elements](https://developers.shopware.com/developers-guide/custom-shopping-world-elements/)

also wie bekommen wir in `ComponentHandlerInterface::handle` unsere eigene service?

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [7. Oktober 2019 um 08:40 UTC](https://forum.shopware.com/t/componenthandlerinterface-service-abfrage/62181/2 "2019-10-07T08:40:59Z")

</div>

Du kannst die dir rein injecten

[https://symfony.com/doc/current/service\_container.html#injecting-services-config-into-a-service](https://symfony.com/doc/current/service_container.html#injecting-services-config-into-a-service)

---

<div class="post-metadata">

**Author:** ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)\
**Post date:** [7. Oktober 2019 um 09:27 UTC](https://forum.shopware.com/t/componenthandlerinterface-service-abfrage/62181/3 "2019-10-07T09:27:36Z")

</div>

FWIW, diese einzeiler geht anscheinend auch:

```
$mein_service = Shopware()->Container()->get("mein_service");

```

&nbsp;
