How to remove all relations ?
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to remove all relations ?
Let's say I create a product, and assign it to a catalog.
In this case, the mshop_catalog_list will contain the relation between the catalog and the product.
What I noticed, if I delete a certain product from the database, it will delete all its relations from the from mshop_product_list as well. However the relations are not deleted from mshop_catalog_list.
For example if I have a product with ID 5 and then I use
It will delete all the relations from mshop_product_list where 'parentid' is 5 (since parentid is a foreign key with cascade)
But mshop_catalog_list will still have a row with 'refid' 5. And that's invalid becuase that item is deleted already.
I tried the same from the admin area, I created a product on the user interface, assign to a catalog. Then I deleted it, checked the database, and those rows with 'refid' still there, cause it's not a foreign key.
In this case, the mshop_catalog_list will contain the relation between the catalog and the product.
What I noticed, if I delete a certain product from the database, it will delete all its relations from the from mshop_product_list as well. However the relations are not deleted from mshop_catalog_list.
For example if I have a product with ID 5 and then I use
Code: Select all
$context = $this->app->make('\Aimeos\Shop\Base\Context')->get();
$product_manager = \Aimeos\MShop\Factory::createManager($context, 'product');
$product_manager->deleteItems( 5 );
But mshop_catalog_list will still have a row with 'refid' 5. And that's invalid becuase that item is deleted already.
I tried the same from the admin area, I created a product on the user interface, assign to a catalog. Then I deleted it, checked the database, and those rows with 'refid' still there, cause it's not a foreign key.
Re: How to remove all relations ?
You are right, the Aimeos simple admin interface doesn't delete the references in the mshop_catalog_lists table. The expert mode admin interface does: https://github.com/aimeos/ai-admin-exta ... rd.php#L90
We will add this to the simple mode admin interface too.
Thanks for the hint!
We will add this to the simple mode admin interface too.
Thanks for the hint!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star