Skip to content
Snippets Groups Projects
Verified Commit 6949416b authored by Damien's avatar Damien
Browse files

FEAT #7697 Delete basket preferences when needed

parent fe22b117
No related branches found
No related tags found
No related merge requests found
......@@ -150,6 +150,11 @@ abstract class BasketModelAbstract
'where' => ['basket_id = ?'],
'data' => [$aArgs['id']]
]);
DatabaseModel::delete([
'table' => 'users_baskets_preferences',
'where' => ['basket_id = ?'],
'data' => [$aArgs['id']]
]);
return true;
}
......
......@@ -14,6 +14,7 @@
namespace Basket\models;
use Group\models\GroupModel;
use SrcCore\models\ValidatorModel;
use SrcCore\models\DatabaseModel;
......@@ -56,6 +57,8 @@ abstract class GroupBasketModelAbstract
ValidatorModel::notEmpty($aArgs, ['basketId', 'groupId']);
ValidatorModel::stringType($aArgs, ['basketId', 'groupId']);
$group = GroupModel::getByGroupId(['select' => ['id'], 'groupId' => $aArgs['groupId']]);
DatabaseModel::delete([
'table' => 'groupbasket',
'where' => ['basket_id = ?', 'group_id = ?'],
......@@ -76,6 +79,11 @@ abstract class GroupBasketModelAbstract
'where' => ['basket_id = ?', 'group_id = ?'],
'data' => [$aArgs['basketId'], $aArgs['groupId']]
]);
DatabaseModel::delete([
'table' => 'users_baskets_preferences',
'where' => ['basket_id = ?', 'group_serial_id = ?'],
'data' => [$aArgs['basketId'], $group['id']]
]);
return true;
}
......
......@@ -167,6 +167,11 @@ abstract class GroupModelAbstract
'where' => ['group_id = ?'],
'data' => [$group['group_id']]
]);
DatabaseModel::delete([
'table' => 'users_baskets_preferences',
'where' => ['group_serial_id = ?'],
'data' => [$aArgs['id']]
]);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment