# Shopware Backend Assoziation

**URL:** <https://forum.shopware.com/t/shopware-backend-assoziation/50888>\
**Category:** Programmierung\
**Created:** [2. Februar 2018 um 21:51 UTC](https://forum.shopware.com/t/shopware-backend-assoziation/50888 "2018-02-02T21:51:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Misengo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/misengo/32/21446_2.png) [@Misengo](https://forum.shopware.com/u/Misengo)\
**Post date:** [2. Februar 2018 um 21:51 UTC](https://forum.shopware.com/t/shopware-backend-assoziation/50888/1 "2018-02-02T21:51:19Z")

</div>

[https://developers.shopware.com/developers-guide/backend-components/associations/](https://developers.shopware.com/developers-guide/backend-components/associations/)

Dort wird beschrieben wie man eine Assoziation herstellt. Nun meine Frage zu bestehenden Models (in meinem Fall Media) - muss ich trotzdem ein Model in **MeinPlugin/Models/Backend** anlegen? Reicht die Referenz in meinem SW Plugin Model nicht?

```
/**
 * @ORM\OneToOne(targetEntity="\Shopware\Models\Media\Media")
 * @ORM\JoinColumn(name="media_id", referencedColumnName="id")
 */
protected $media;

```

&nbsp;

&nbsp;

PS: Allen ein schönes Wochenende 😉

---

<div class="post-metadata">

**Author:** ![derwunner](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@derwunner](https://forum.shopware.com/u/derwunner)\
**Post date:** [5. Februar 2018 um 08:50 UTC](https://forum.shopware.com/t/shopware-backend-assoziation/50888/2 "2018-02-05T08:50:22Z")

</div>

Hallo,

die Assoziation herstellen ist die eine Sache. Das heißt aber nicht, dass bei Ändeurngen im Backend die Daten von deiner Assoziation mit gespeichert werden. Der Shopware Code kennt deine Assoziation schließlich nicht.&nbsp;Darum musst du dich selber kümmern. Also: Alle Events abonnieren, bei deinen deine Assoziation relevant sein kann und dementsprechend die Daten anreichern.

&nbsp;

MFG

&nbsp;

derwunner
