# PROBLEM: Nach Plugin Deinstallation verbleiben Attribute in "Variablen Informationen" von sORDER

**URL:** <https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504>\
**Category:** Programmierung\
**Created:** [16. November 2017 um 10:42 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504 "2017-11-16T10:42:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)\
**Post date:** [16. November 2017 um 10:42 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/1 "2017-11-16T10:42:57Z")

</div>

Hallo,&nbsp;

wir haben ein Plugin, welches Freitextfelder in der Tabelle&nbsp; **s\_articles\_attributes** :

```
/** @var CrudService $Service */
		$service = Shopware()->Container()->get('shopware_attribute.crud_service');

		$service->update('s_articles_attributes', 'attributName', 'string', [
			'label' => 'Beispiel',
			'translatable' => true,
			'displayInBackend' => true,
			'position' => 50
		]);

Shopware()->Models()->generateAttributeModels(['s_articles_attributes']);

```

Diese Attribute Variablen finden sich auch in **Einstellungen \> E-Mail Vorlagen \> sORDER \> “Variablen Informationen”** - z.B.:

```
{$sOrderDetails.0.additional_details.attributes.core.attributName}

```

&nbsp;

Nach der Deinstallation des Plugins sind diese noch immer vorhanden, obwohl die Freitextfelder aus der Datenbank entfernt werden mit:&nbsp;

```
/** @var CrudService $Service */
$service = Shopware()->Container()->get('shopware_attribute.crud_service');

$service->delete('s_articles_attributes', 'attributName');

Shopware()->Models()->generateAttributeModels(['s_articles_attributes']);

```

&nbsp;

Im Frontend erhalten wir nach deinstalliertem Plugin einen Fehler:&nbsp;

```
[2017-11-16 07:55:42] core.ERROR: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't28.attributName' in 'field list' in /html/shopware/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:828 

```

&nbsp;

&nbsp;

Was kann das sein? Und wie aktualisiert sich das Feld context in der Datenbank der Mailvorlagen? Also das feld&nbsp; **Variablen Informationen?**

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. November 2017 um 10:50 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/2 "2017-11-16T10:50:26Z")

</div>

Die Variablen-Informationen werden gespeichert, wenn die Mail im Frontend verschickt wird. Es werden also immer die Variablen angezeigt, die beim letzten Mailversand verfügbar waren. Das erledigt sich also von alleine.

&nbsp;

Die Fehlermeldung deutet auf ein Problem mit den Attribute-Models hin. Sieht mir so aus, als ob der Cache noch nicht weiß, dass die Attribute nicht mehr da sind. Am besten mal generateAttributeModels über CLI machen oder den Cache Ordner komplett per FTP löschen.

---

<div class="post-metadata">

**Author:** ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)\
**Post date:** [16. November 2017 um 11:07 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/3 "2017-11-16T11:07:09Z")

</div>

Hallo [@Moritz Naczenski]([http://forum.shopware.com/profile/14574/Moritz](http://forum.shopware.com/profile/14574/Moritz) Naczenski “Moritz Naczenski”)‍

vielen Dank für deine Antwort.

Prinzipiell führe ich im Plugin bei der Deinstallation&nbsp;Shopware()-\>Models()-\>generateAttributeModels([‘s\_articles\_attributes’]); aus - reicht das nicht? Wie kommt es zu dem Problem? Bei anderen Kunden passiert das nicht. Ich hatte mal gehört, dass das Shopware Security Plugin dahingehend irgendetwas blockiert und Kunden daraufhin Probleme beim installieren oder deinstallieren von Plugins mit Attributen hatten. Kann das sein?!

&nbsp;

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [16. November 2017 um 11:20 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/4 "2017-11-16T11:20:47Z")

</div>

Glaub ich eigentlich nicht.

Manchmal werden die Models&nbsp;aber ggf. noch von anderen Caches bspw. opcache oder APCu speichert.

&nbsp;

---

<div class="post-metadata">

**Author:** ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)\
**Post date:** [16. November 2017 um 11:21 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/5 "2017-11-16T11:21:24Z")

</div>

Muss man dann im Plugin noch etwas anpassen? Solche Fehler sollen ja nicht passieren.

---

<div class="post-metadata">

**Author:** ![mdsw](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mdsw](https://forum.shopware.com/u/mdsw)\
**Post date:** [28. November 2017 um 18:20 UTC](https://forum.shopware.com/t/problem-nach-plugin-deinstallation-verbleiben-attribute-in-variablen-informationen-von-sorder/49504/6 "2017-11-28T18:20:51Z")

</div>

[@Moritz Naczenski]([http://forum.shopware.com/profile/14574/Moritz](http://forum.shopware.com/profile/14574/Moritz) Naczenski “Moritz Naczenski”)‍

ich glaube ich habe eine Ursache für dieses Verhalten gefunden. In verwende:&nbsp;

```
$metaDataCache = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCache->deleteAll();

Shopware()->Models()->generateAttributeModels(['s_XY_attributes']);

```

lediglich in der Funktion zum Hinzufügen der Attribute. In der Funktion zum Löschen der Attribute beim Deinstallieren verwende ich lediglich:&nbsp;

```
Shopware()->Models()->generateAttributeModels(['s_XY_attributes']);

```

&nbsp;

&nbsp;

Möglicherweise liegt es daher an den fehlenden zwei Zeilen zur Invalidierung des MetadataCaches?!
