You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What are you trying to do?
I would like to fetch many orders and their statuses at once, so it would be nice if you could cache order statuses in your component
publicfunctiongetAllOrderStatuses($withTrashed = false): array
{
// Get the caches items if we have them cached, and the request is for non-trashed itemsif ($this->_orderStatuses !== null) {
return$this->_orderStatuses;
}
$results = $this->_createOrderStatusesQuery($withTrashed)->all();
$orderStatuses = [];
foreach ($resultsas$row) {
$orderStatuses[] = newOrderStatus($row);
}
$this->_orderStatuses = $orderStatuses// new linereturn$orderStatuses;
}
The text was updated successfully, but these errors were encountered:
What are you trying to do?
I would like to fetch many orders and their statuses at once, so it would be nice if you could cache order statuses in your component
What's your proposed solution?
Cache your Order statuses, all you need to do is to include a
$this->_orderStatuses = $orderStatuses
herehttps://github.com/craftcms/commerce/blob/develop/src/services/OrderStatuses.php#L90
The text was updated successfully, but these errors were encountered: