# Inhalt einer Custom Table löschen

**URL:** <https://forum.shopware.com/t/inhalt-einer-custom-table-loschen/65198>\
**Category:** Programmierung\
**Created:** [3. März 2020 um 21:20 UTC](https://forum.shopware.com/t/inhalt-einer-custom-table-loschen/65198 "2020-03-03T21:20:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moki](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@moki](https://forum.shopware.com/u/moki)\
**Post date:** [3. März 2020 um 21:20 UTC](https://forum.shopware.com/t/inhalt-einer-custom-table-loschen/65198/1 "2020-03-03T21:20:36Z")

</div>

Hallo,

ich habe ein Plugin, wo ich eine custom-table mit Inhalten fülle. Wie kann ich die Tabelle wieder leeren (innerhalb eines Services). Ich habe ein Repository vom Typ EntityRepositoryInterface, aber ich kann nicht erst alle IDs auslesen und danach per delete() löschen. Besser wäre ein Truncate oder Delete \*. Habt Ihr irgendwelche Tipps?

Kann man direct auf Doctrine DBAL zugreifen?

Grüße Micha

---

<div class="post-metadata">

**Author:** ![Moorleiche](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Moorleiche](https://forum.shopware.com/u/Moorleiche)\
**Post date:** [4. März 2020 um 15:14 UTC](https://forum.shopware.com/t/inhalt-einer-custom-table-loschen/65198/2 "2020-03-04T15:14:25Z")

</div>

?&nbsp;

```
$connection->executeQuery('TRUNCATE TABLE `table_name`');

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![moki](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@moki](https://forum.shopware.com/u/moki)\
**Post date:** [4. März 2020 um 20:05 UTC](https://forum.shopware.com/t/inhalt-einer-custom-table-loschen/65198/3 "2020-03-04T20:05:13Z")

</div>

Hallo,

das ist viel zu einfach 😉

Auf die logischste einfache Lösung bin ich nicht gekommen. Gibt es noch einen weiteren Weg irgendwie über Repository oder andere Helper Klassen, also&nbsp;&nbsp;mit Shopware Mitteln?

> [@Moorleiche schrieb:](https://forum.shopware.com/profile/32221/Moorleiche "Moorleiche")
> 
> ?&nbsp;
> 
> $connection-\>executeQuery(‚TRUNCATE TABLE `table_name`‘);
> 
> &nbsp;
