protected function OrderStorage::postLoad in Commerce Core 8.2
Attaches data to entities upon loading.
Parameters
array $entities: Associative array of query results, keyed on the entity ID.
Overrides CommerceContentEntityStorage::postLoad
File
- modules/
order/ src/ OrderStorage.php, line 156
Class
- OrderStorage
- Defines the order storage.
Namespace
Drupal\commerce_orderCode
protected function postLoad(array &$entities) {
if (!$this->skipRefresh) {
/** @var \Drupal\commerce_order\Entity\OrderInterface[] $entities */
foreach ($entities as $entity) {
$explicitly_requested = $entity
->getRefreshState() == OrderInterface::REFRESH_ON_LOAD;
if ($explicitly_requested || $this->orderRefresh
->shouldRefresh($entity)) {
// Reuse the doPostLoad logic.
$entity
->setRefreshState(OrderInterface::REFRESH_ON_SAVE);
$entity
->save();
}
}
}
return parent::postLoad($entities);
}