# How to remove associated records from database after click Save in administration?

**URL:** <https://forum.shopware.com/t/how-to-remove-associated-records-from-database-after-click-save-in-administration/101639>\
**Category:** Shopware 6 (English)\
**Created:** [20. Oktober 2023 um 08:09 UTC](https://forum.shopware.com/t/how-to-remove-associated-records-from-database-after-click-save-in-administration/101639 "2023-10-20T08:09:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [20. Oktober 2023 um 08:09 UTC](https://forum.shopware.com/t/how-to-remove-associated-records-from-database-after-click-save-in-administration/101639/1 "2023-10-20T08:09:39Z")

</div>

Hi, friends!  
I extended the **product\_manufacturer** entity with custom OneToMany association. Now, when I open Manufacturer page in administration - I see all associated records. If I change something in these records and click Save - all data saves perfect (I do it via extensions property). Also I have a button **Add New Record** on Manufacturer page, if I click it - new fields are added to the page and after click Save - these data stores to database as new records in associated table as well.  
Also I have a button **Delete Record** for each associated record, when I click it - it removes associated record from extensions-property and it removes from page. Then I wish to remove deleted associated records from database after I click Save button, but how I can do it? Yes, I can remove record form database immediatelly after click **Delete Record** , but it would be great remove it after Manufacturer saving. Thanks for helping!

---

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [20. Oktober 2023 um 11:38 UTC](https://forum.shopware.com/t/how-to-remove-associated-records-from-database-after-click-save-in-administration/101639/2 "2023-10-20T11:38:36Z")

</div>

Ok, I found solution, don’t worry)  
I just rewrote parent method loadEntityData() for that and it is enough for me.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)\
**Post date:** [19. November 2023 um 11:38 UTC](https://forum.shopware.com/t/how-to-remove-associated-records-from-database-after-click-save-in-administration/101639/3 "2023-11-19T11:38:44Z")

</div>

Geschlossen, am 19. November 2023 um 11:38 UTC

Dieses Thema wurde automatisch 30 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.
