public function Order::getData in Commerce Core 8.2
Gets an order data value with the given key.
Used to store temporary data during order processing (i.e. checkout).
Parameters
string $key: The key.
mixed $default: The default value.
Return value
mixed The value.
Overrides OrderInterface::getData
2 calls to Order::getData()
- Order::getRefreshState in modules/
order/ src/ Entity/ Order.php - Gets the order refresh state.
- Order::preSave in modules/
order/ src/ Entity/ Order.php - Acts on an entity before the presave hook is invoked.
File
- modules/
order/ src/ Entity/ Order.php, line 546
Class
- Order
- Defines the order entity class.
Namespace
Drupal\commerce_order\EntityCode
public function getData($key, $default = NULL) {
$data = [];
if (!$this
->get('data')
->isEmpty()) {
$data = $this
->get('data')
->first()
->getValue();
}
return isset($data[$key]) ? $data[$key] : $default;
}