diff --git a/src/Plugin/resource/DataProvider/DataProviderEntity.php b/src/Plugin/resource/DataProvider/DataProviderEntity.php index d8be6bdc..80389a1b 100644 --- a/src/Plugin/resource/DataProvider/DataProviderEntity.php +++ b/src/Plugin/resource/DataProvider/DataProviderEntity.php @@ -346,6 +346,13 @@ public function canonicalPath($path) { */ public function entityPreSave(\EntityDrupalWrapper $wrapper) {} + /** + * {@inheritdoc} + */ + public function entitySave(\EntityDrupalWrapper $wrapper) { + $wrapper->save(); + } + /** * {@inheritdoc} */ @@ -1057,8 +1064,7 @@ protected function setPropertyValues(\EntityDrupalWrapper $wrapper, $object, $re $this->entityPreSave($interpreter->getWrapper()); $this->entityValidate($interpreter->getWrapper()); - - $wrapper->save(); + $this->entitySave($interpreter->getWrapper()); } /** diff --git a/src/Plugin/resource/DataProvider/DataProviderEntityInterface.php b/src/Plugin/resource/DataProvider/DataProviderEntityInterface.php index bb808255..0d68a215 100644 --- a/src/Plugin/resource/DataProvider/DataProviderEntityInterface.php +++ b/src/Plugin/resource/DataProvider/DataProviderEntityInterface.php @@ -19,6 +19,14 @@ interface DataProviderEntityInterface extends DataProviderInterface { */ public function entityPreSave(\EntityDrupalWrapper $wrapper); + /** + * Save an entity. + * + * @param \EntityDrupalWrapper $wrapper + * The wrapped entity. + */ + public function entitySave(\EntityDrupalWrapper $wrapper); + /** * Validate an entity before it is saved. *