/** * {@inheritdoc} */ public function getValue() { $values = parent::getValue(); // If there is an unsaved entity, return it as part of the field item values // to ensure idempotency of getValue() / setValue(). if ($this->hasNewEntity()) { $values['entity'] = $this->entity; } return $values; }