Skip to content

Conversation

@rocketweb
Copy link
Collaborator

No description provided.

private function getStoreCodes($stores): array
{
$storeCodes = [];
if ($stores) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $stores is empty, then return STORE_SCOPE_ALL, use early return

foreach ($stores as $storeId) {
try {
$store = $this->storeManager->getStore($storeId);
$storeCode = $storeId ? $store->getCode() : self::STORE_SCOPE_ALL;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if $storeId = 0, then we already have all store scopes (admin scope), in that case it should be:
return [self::STORE_SCOPE_ALL];
since nothing else is needed (you can't select ALL + additional store scopes).

@rocketweb rocketweb merged commit 95cf57d into main Jan 4, 2024
@rocketweb rocketweb deleted the ICP-3-stores_support branch January 4, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants