# Kategorie Update Fehler über API wenn Einkaufswelt vorhanden ist

**URL:** <https://forum.shopware.com/t/kategorie-update-fehler-uber-api-wenn-einkaufswelt-vorhanden-ist/42193>\
**Category:** Programmierung\
**Created:** [14. Dezember 2016 um 16:56 UTC](https://forum.shopware.com/t/kategorie-update-fehler-uber-api-wenn-einkaufswelt-vorhanden-ist/42193 "2016-12-14T16:56:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadis](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kadis](https://forum.shopware.com/u/kadis)\
**Post date:** [14. Dezember 2016 um 16:56 UTC](https://forum.shopware.com/t/kategorie-update-fehler-uber-api-wenn-einkaufswelt-vorhanden-ist/42193/1 "2016-12-14T16:56:12Z")

</div>

Hallo Zusammen,

ich bekomme bei einem Test-Shop eine Fehlermeldung wenn ich über die API die Kategoriedaten ändern möchte.  
Es trifft Kategorien, die eine Einkaufswelt haben.

Die Meldung:

```
Expected value of type "Doctrine\Common\Collections\Collection|array" for association field "Shopware\Models\Category\Category#$emotions", got "array" instead.

```

Das Array was ich übergebe, ist das was ich von der API gemeldet bekomme, wo ich eigentlich nur Beschreibungen, Attr, etc. abändere. Es werden keine keys hinzugefügt.

```
(
            [id] => 3
            [parentId] => 1
            [streamId] =>
            [name] => Deutsch
            [position] => 0
            [metaTitle] =>
            [metaKeywords] =>
            [metaDescription] =>
            [cmsHeadline] =>
            [cmsText] =>
            [active] => 1
            [template] =>
            [productBoxLayout] =>
            [blog] => 0
            [path] =>
            [external] =>
            [hideFilter] => 0
            [hideTop] => 0
            [changed] => 2014-11-06T19:24:16+0100
            [added] => 2014-11-06T19:24:16+0100
            [mediaId] =>
            [attribute] => Array
                (
                    [id] => 19
                    [categoryId] => 3
                    [attribute1] =>
                    [attribute2] =>
                    [attribute3] =>
                    [attribute4] =>
                    [attribute5] =>
                    [attribute6] =>
                    [coeGoogleProductCategory] => 
                    [coeGoogleProductTyp] => 
                    [sixSeoUrl] =>
                )

            [emotions] => Array
                (
                    [0] => Array
                        (
                            [id] => 1
                            [parentId] =>
                            [active] => 1
                            [name] => Startseite
                            [userId] => 52
                            [position] => 1
                            [device] => 0,1,2,3,4
                            [fullscreen] => 0
                            [validFrom] => 2016-04-18T00:00:00+0200
                            [isLandingPage] => 0
                            [seoTitle] =>
                            [seoKeywords] =>
                            [seoDescription] =>
                            [validTo] =>
                            [createDate] => 2014-07-01T22:02:52+0200
                            [modified] => 2016-11-07T09:19:40+0100
                            [rows] => 23
                            [cols] => 4
                            [cellSpacing] => 10
                            [cellHeight] => 185
                            [articleHeight] => 2
                            [showListing] =>
                            [templateId] => 1
                            [mode] => resize
                        )

                )

            [media] =>
            [customerGroups] => Array
                (
                )

            [0] => Array
                (
                    [id] => 3
                    [parentId] => 1
                    [streamId] =>
                    [name] => Deutsch
                    [position] =>
                    [metaTitle] =>
                    [metaKeywords] =>
                    [metaDescription] =>
                    [cmsHeadline] =>
                    [cmsText] =>
                    [active] => 1
                    [template] =>
                    [productBoxLayout] =>
                    [blog] => 1
                    [path] =>
                    [external] =>
                    [hideFilter] =>
                    [hideTop] =>
                    [changed] => 2014-11-06T19:24:16+0100
                    [added] => 2014-11-06T19:24:16+0100
                    [mediaId] =>
                    [attribute] => Array
                        (
                            [id] => 19
                            [categoryId] => 3
                            [attribute1] =>
                            [attribute2] =>
                            [attribute3] =>
                            [attribute4] =>
                            [attribute5] =>
                            [attribute6] =>
                            [coeGoogleProductCategory] => 
                            [coeGoogleProductTyp] => 
                            [sixSeoUrl] =>
                        )

                    [emotions] => Array
                        (
                            [0] => Array
                                (
                                    [id] => 1
                                    [parentId] =>
                                    [active] => 1
                                    [name] => Startseite
                                    [userId] => 52
                                    [position] => 1
                                    [device] => 0,1,2,3,4
                                    [fullscreen] => 0
                                    [validFrom] => 2016-04-18T00:00:00+0200
                                    [isLandingPage] => 0
                                    [seoTitle] =>
                                    [seoKeywords] =>
                                    [seoDescription] =>
                                    [validTo] =>
                                    [createDate] => 2014-07-01T22:02:52+0200
                                    [modified] => 2016-11-07T09:19:40+0100
                                    [rows] => 23
                                    [cols] => 4
                                    [cellSpacing] => 10
                                    [cellHeight] => 185
                                    [articleHeight] => 2
                                    [showListing] =>
                                    [templateId] => 1
                                    [mode] => resize
                                )

                        )

                    [media] =>
                    [customerGroups] => Array
                        (
                        )

                )

            [childrenCount] => 11
            [articleCount] => 4042
        )

```

Hat jemand einen Tipp, womit dies zusammen hängt, bzw. wie man es beheben kann?

Beste Grüße

---

<div class="post-metadata">

**Author:** ![steinsoftware](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@steinsoftware](https://forum.shopware.com/u/steinsoftware)\
**Post date:** [16. Dezember 2016 um 12:55 UTC](https://forum.shopware.com/t/kategorie-update-fehler-uber-api-wenn-einkaufswelt-vorhanden-ist/42193/2 "2016-12-16T12:55:25Z")

</div>

Steht doch in der Meldung.

Du übergibst ein Array und erwartet wird eine ArrayCollection.

Dies hier einbinden:

```
**use** Doctrine\Common\Collections\ArrayCollection;

```

und dann nutzen:

$x = new ArrayCollection($array);

&nbsp;

---

<div class="post-metadata">

**Author:** ![kadis](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kadis](https://forum.shopware.com/u/kadis)\
**Post date:** [16. Dezember 2016 um 14:12 UTC](https://forum.shopware.com/t/kategorie-update-fehler-uber-api-wenn-einkaufswelt-vorhanden-ist/42193/3 "2016-12-16T14:12:03Z")

</div>

Hy,

das war es leider nicht.  
Ich habe nun ein zweiten Test-Shop aufgesetzt. Hier klappte es auf Anhieb richtig.  
Importscript wurde nicht verändert…

&nbsp;

&nbsp;
