public function OrderItem::unsetData in Commerce Core 8.2
Unsets an order item data value with the given key.
Parameters
string $key: The key.
Return value
$this
Overrides OrderItemInterface::unsetData
File
- modules/
order/ src/ Entity/ OrderItem.php, line 300
Class
- OrderItem
- Defines the order item entity class.
Namespace
Drupal\commerce_order\EntityCode
public function unsetData($key) {
if (!$this
->get('data')
->isEmpty()) {
$data = $this
->get('data')
->first()
->getValue();
unset($data[$key]);
$this
->set('data', $data);
}
return $this;
}