Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3836 by reptilee
16 Jan 2017, 02:07
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

Code: Select all   
    $context = $this->app->make('\Aimeos\Shop\Base\Context')->get();
    $product_manager = \Aimeos\MShop\Factory::createManager($context, 'product');
    $product_manager->deleteItems( 5 );

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.
#3837 by aimeos
16 Jan 2017, 11:23
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:

We will add this to the simple mode admin interface too.
Thanks for the hint!