# Wie kommt man in einem Controller an den aktuellen User

**URL:** <https://forum.shopware.com/t/wie-kommt-man-in-einem-controller-an-den-aktuellen-user/53769>\
**Category:** Programmierung\
**Created:** [28. Juni 2018 um 14:43 UTC](https://forum.shopware.com/t/wie-kommt-man-in-einem-controller-an-den-aktuellen-user/53769 "2018-06-28T14:43:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiwso](https://avatars.discourse-cdn.com/v4/letter/h/e47774/32.png) [@hiwso](https://forum.shopware.com/u/hiwso)\
**Post date:** [28. Juni 2018 um 14:43 UTC](https://forum.shopware.com/t/wie-kommt-man-in-einem-controller-an-den-aktuellen-user/53769/1 "2018-06-28T14:43:06Z")

</div>

Hallo,

ich versuche in einem Plugin Controller bei Shopware 5.4.5 an den aktuell eingeloggeten User zu kommen. Ich habe die User ID, der User existiert:

```
 \> select customernumber from s\_user where id = 1; +----------------+ | customernumber | +----------------+ | 20003 | +----------------+ 

```

Aber sowohl das:

```
 $this-\>getModelManager()-\>getRepository('\Shopware\Models\User\User')-\>find(1);

```

wie auch das:

```
 $this-\>models-\>find(\Shopware\Models\User\User::class, 1);

```

Liefern nur NULL.

Woran koennte das liegen?

P.S.: Ein Klick auf ‚Shop popular tags‘ hier im Forum reloaded die Seite und schmeisst die ganze Eingabe weg, nicht gerade hilfreich (Firefox/Linux)

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [2. Juli 2018 um 11:12 UTC](https://forum.shopware.com/t/wie-kommt-man-in-einem-controller-an-den-aktuellen-user/53769/2 "2018-07-02T11:12:14Z")

</div>

Mal mit Shopware()-\>Modules()-\>Admin()-\>sGetUserData() versucht?

---

<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:** [2. Juli 2018 um 11:49 UTC](https://forum.shopware.com/t/wie-kommt-man-in-einem-controller-an-den-aktuellen-user/53769/3 "2018-07-02T11:49:51Z")

</div>

```
 \Shopware\Models\User\User sind die BackendUser. Kunden sind das Model 

 \Shopware\Models\Customer\Customer. 

```

Das erkennst du an dem Keyword Table:&nbsp;[https://github.com/shopware/shopware/blob/5.4/engine/Shopware/Models/Customer/Customer.php#L57](https://github.com/shopware/shopware/blob/5.4/engine/Shopware/Models/Customer/Customer.php#L57)

Viele Grüße
