-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX : 14958 - sales sequence store delete #18466
FIX : 14958 - sales sequence store delete #18466
Conversation
…iew deletion - clean construct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the review comments. Also, the implementation is removing rows only from the sales_sequence_profile
table, please consider removing corresponding rows from sales_sequence_meta
as well to provide a complete fix for the issue #14958
@@ -51,6 +51,9 @@ | |||
<event name="store_add"> | |||
<observer name="magento_sequence" instance="Magento\SalesSequence\Observer\SequenceCreatorObserver" /> | |||
</event> | |||
<event name="store_delete"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that the functionality is on SalesSequence module side, this event configuration should be moved to that module as well
$select = $connection->select() | ||
->from($this->getMainTable(), ['profile_id']) | ||
->where('meta_id = :meta_id') | ||
->where('is_active = 1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that non-active profiles should be removed as well in case of store delete
|
||
$profileIds = $this->resourceProfile->getProfileIds($metadata->getId()); | ||
|
||
foreach ($profileIds as $profileId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove all profiles with a single query. Is there a way to do so?
public function execute(EventObserver $observer) | ||
{ | ||
$storeId = $observer->getData('store')->getId(); | ||
foreach ($this->entityPool->getEntities() as $entityType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better from a performance point of view to load all meta_ids using a single query, also entityType is not really required for this operation, as the delete operation is performed for all the entity types
Hi @synolia-bvo , would you like to continue work on this PR? |
@synolia-bvo closing due to inactivity. Feel free to contact me if you'd like to continue work on this contribution. |
Description
sale_sequence_* records are not removed on store view deletion
Fixed Issues (if relevant)
#14958
Manual testing scenarios
Contribution checklist