1

If I do not provide $storeId argument for methods get() or getById what store id would be used? Default? Or current?

If I DO use this argument we can see that it will be set and data specific for data store will be obtained, but I don't see what will happen if no id is provided.

public function get($sku, $editMode = false, $storeId = null, $forceReload = false) { $cacheKey = $this->getCacheKey([$editMode, $storeId]); if (!isset($this->instances[$sku][$cacheKey]) || $forceReload) { $product = $this->productFactory->create(); $productId = $this->resourceModel->getIdBySku($sku); if (!$productId) { throw new NoSuchEntityException(__('Requested product doesn\'t exist')); } if ($editMode) { $product->setData('_edit_mode', true); } if ($storeId !== null) { $product->setData('store_id', $storeId); } $product->load($productId); $this->instances[$sku][$cacheKey] = $product; $this->instancesById[$product->getId()][$cacheKey] = $product; } return $this->instances[$sku][$cacheKey]; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.