# Wie erstelle ich Slot Translations korrekt?

**URL:** <https://forum.shopware.com/t/wie-erstelle-ich-slot-translations-korrekt/62618>\
**Category:** Shopware 6 (German)\
**Created:** [25. Oktober 2019 um 19:29 UTC](https://forum.shopware.com/t/wie-erstelle-ich-slot-translations-korrekt/62618 "2019-10-25T19:29:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nordisch](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@Nordisch](https://forum.shopware.com/u/Nordisch)\
**Post date:** [25. Oktober 2019 um 19:29 UTC](https://forum.shopware.com/t/wie-erstelle-ich-slot-translations-korrekt/62618/1 "2019-10-25T19:29:09Z")

</div>

Hi zusammen,

ich scheitere gerade an den Translations ☹

Würde mich über jeden Hinweis freuen.

Aktuell erhalte ich folgenden SQL Fehler:  
(Ich bin auf der EA2 und habe bin/console dal:refresh:index ausgeführt)

> An exception occurred while executing ‚INSERT INTO `cms_slot_translation` (`cms_slot_id`, `language_id`, `cms_slot_version_id`, `config`, `created_at`) VALUES (?, ?, ?, ?, ?)‘ with params [„\x37\x55\x01\xde\x47\x6a\x4e\xce\x97\x86\xc2\x92\xb8\x4d\xaa\x0f“, „\xfc\x78\x54\x5c\x05\x4f\x43\x73\x92\x4c\xa5\x49\x66\xa7\xb8\x36“, „\x0f\xa9\x1c\xe3\xe9\x6a\x4b\xc2\xbe\x4b\xd9\xce\x75\x2c\x34\x25“, „{"content":{"value":"\n\t\tJETZT F\u00dcR EN-GB asdfasdf as fasdf asdf  
> asdfasdf  
> .\n\t","source":"static"}}“, „2019-10-25 19:09:35.528“]:
> 
> SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`shopware_6`.`cms_slot_translation`, CONSTRAINT `fk.cms_slot_translation.language_id` FOREIGN KEY (`language_id`) REFERENCES `language` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

&nbsp;

```
        $entityUpdate = [
            'id' => $slot->getId(),
            'translations' => [
                $language->getId() => [
                    'config' => $config
                ]
            ]
        ];

        return $this->cmsSlotRepository->upsert(
            [
                $entityUpdate
            ],
            Context::createDefaultContext()
        );

```

Hier noch das $entityUpdate Arrray als dump:

```
Array
(
    [id] => 375501de476a4ece9786c292b84daa0f
    [translations] => Array
        (
            [fc78545c054f4373924ca54966a7b836] => Array
                (
                    [config] => Array
                        (
                            [content] => Array
                                (
                                    [value] => 
		JETZT FÜR EN-GB asdfasdf as fasdf asdf asdfasdf.
	
                                    [source] => static
                                )

                        )

                )

        )

)

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Nordisch](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@Nordisch](https://forum.shopware.com/u/Nordisch)\
**Post date:** [26. Oktober 2019 um 14:15 UTC](https://forum.shopware.com/t/wie-erstelle-ich-slot-translations-korrekt/62618/2 "2019-10-26T14:15:10Z")

</div>

War wohl schon zu spät am Abend&nbsp; ![Blush](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/blush.png "Blush")

Die Variable&nbsp;$language war in wirklichkeit die LocaleEntity. Mittels dieser musste ich erst die Lanugage ermitteln und natürlich dessen ID verwenden.
