# Model für s\_articles erweitern

**URL:** <https://forum.shopware.com/t/model-fur-s-articles-erweitern/41081>\
**Category:** Programmierung\
**Created:** [4. November 2016 um 09:29 UTC](https://forum.shopware.com/t/model-fur-s-articles-erweitern/41081 "2016-11-04T09:29:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbdus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/mbdus/32/12997_2.png) [@mbdus](https://forum.shopware.com/u/mbdus)\
**Post date:** [4. November 2016 um 09:29 UTC](https://forum.shopware.com/t/model-fur-s-articles-erweitern/41081/1 "2016-11-04T09:29:54Z")

</div>

Hallo zusammen,

ich würde gerne statt der DB-Tabelle s\_articles\_related eine eigene Tabelle verwenden. Um die n:m Relation herzustellen, müsste ich auch das Article-Model erweitern.

Ich habe in meinem Plugin folgende Ordnerstruktur:

Models -\> MyArticle -\> Article.php

Models -\> MyArticle -\> Relatedarticle.php

Models -\> MyArticle -\> Repository.php

D.h. ich habe einen Namespace von Shopware\CustomModels\MyArticle. Kann ich das so machen?

Die Article.php habe ich um folgenden Eintrag erweitert:

```
/**
     * INVERSE SIDE
     *
     * @var ArrayCollection
     *
     * @Assert\Valid
     *
     * @ORM\OneToMany(targetEntity="Shopware\CustomModels\MyArticle\Relatedarticle", mappedBy="article", orphanRemoval=true, cascade={"persist"})
     */
    
    protected $relatedaccessoirearticle;

```

Kann es dadurch zu Namespace-Problemen kommen? Ab Shopware 5.2 scheint es zu funktionieren. Mit Shopware 5.1 wird nicht immer die Funktion aus meinem eigenen Repository gefunden.

Vielen Dank im Voraus.

Grüße

Mathias
