# Supplier nach Attribut abrufen - model

**URL:** https://forum.shopware.com/t/supplier-nach-attribut-abrufen-model/56451
**Category:** Programmierung
**Created:** [14. November 2018 um 16:18 UTC](https://forum.shopware.com/t/supplier-nach-attribut-abrufen-model/56451 "2018-11-14T16:18:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sition](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Sition](https://forum.shopware.com/u/Sition)
#### Post date: [14. November 2018 um 16:18 UTC](https://forum.shopware.com/t/supplier-nach-attribut-abrufen-model/56451/1 "2018-11-14T16:18:40Z")

</div>

Hallo!

Ich versuche, Suppliers anhand eines attributs abzurufen. Leider noch kein glück.

Was ich getan habe:

```
$service = $this->container->get('shopware_attribute.crud_service');
$service->update('s_articles_supplier_attributes', 'show_in_slider', 'boolean', [
            'label' => 'Active for slider',
                'supportText' => 'Active',
                'helpText' => 'Only selected suppliers are shown within slider',

                // user has the opportunity to translate the attribute field for each shop
                'translatable' => false,

                // attribute will be displayed in the backend module
                'displayInBackend' => true,

                //user can modify the attribute in the free text field module
                'custom' => false,

            ]
        );

Shopware()->Container()->get('models')->generateAttributeModels();

```

Wenn ich versuche, den Lieferanten über das Attribut abzurufen, erhalte ich immer noch den fehler: Uncaught Doctrine\ORM\ORMException: Unrecognized field: showInSlider"

```
$params = ['showInSlider' => 1];
$sort = [];

$suppliers = Shopware()->Container()->get('models')->getRepository(Supplier::class)->findBy( $params, $sort );

```

Ich habe das Shopware-Entwickler-Cheatsheet ([Cheat-Sheet for developers](https://developers.shopware.com/developers-guide/cheat-sheet/)) überprüft, das Folgendes zeigt:

Naming - Attribute generation[Anchor link for: naming attribute generation](https://developers.shopware.com/developers-guide/cheat-sheet/#naming-attribute-generation)

If you get the&nbsp;`Error: Unrecognized field: my_field`&nbsp;when querying for your attribute it could be that you forgot to generate the attribute models:

```
$this->container()->get('models')->generateAttributeModels();

```

or ran into naming issues:

- the field name gets&nbsp; **lower cased** &nbsp;before added to the database
- when using underscores(`_`) in field names they must be queried in&nbsp; **camel case**

&nbsp;

Was mache ich falsch?

---

<div class="post-metadata">

### Author: ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)
#### Post date: [15. November 2018 um 10:47 UTC](https://forum.shopware.com/t/supplier-nach-attribut-abrufen-model/56451/2 "2018-11-15T10:47:34Z")

</div>

Müsste es nicht sein:

$this-\>container()-\>get(‚models‘)-\>generateAttributeModels([‚s\_articles\_supplier\_attributes‘]);

Wobei ich glaube, dass das mit Shopware 5.2+ weg gefallen ist, oder? Welche Version nutzt du?

Schau mal hier -\>&nbsp;[Attribute system](https://developers.shopware.com/developers-guide/attribute-system/?_ga=2.73945554.1159952110.1541346450-1834396425.1532084730#rebuild-attribute-models)
