Skip to content

Commit

Permalink
ENGCOM-8364: Updated string with Static key. #30579
Browse files Browse the repository at this point in the history
 - Merge Pull Request #30579 from ejaz-alam/magento2:patch-2
 - Merged commits:
   1. 6970b19
   2. fd4a5a7
  • Loading branch information
magento-engcom-team committed Oct 22, 2020
2 parents 68c903f + fd4a5a7 commit eb2d31f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/code/Magento/Quote/Model/Quote/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class Address extends AbstractAddress implements
const ADDRESS_TYPE_BILLING = 'billing';

const ADDRESS_TYPE_SHIPPING = 'shipping';

private const CACHED_ITEMS_ALL = 'cached_items_all';

/**
* Prefix of model events
Expand Down Expand Up @@ -636,8 +638,7 @@ public function getItemsCollection()
public function getAllItems()
{
// We calculate item list once and cache it in three arrays - all items
$key = 'cached_items_all';
if (!$this->hasData($key)) {
if (!$this->hasData(self::CACHED_ITEMS_ALL)) {
$quoteItems = $this->getQuote()->getItemsCollection();
$addressItems = $this->getItemsCollection();

Expand Down Expand Up @@ -676,10 +677,10 @@ public function getAllItems()
}

// Cache calculated lists
$this->setData('cached_items_all', $items);
$this->setData(self::CACHED_ITEMS_ALL, $items);
}

$items = $this->getData($key);
$items = $this->getData(self::CACHED_ITEMS_ALL);

return $items;
}
Expand Down

0 comments on commit eb2d31f

Please sign in to comment.