Skip to content

Commit

Permalink
Add an entitySave() method to DataProviderEntity.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsacksick committed Apr 27, 2018
1 parent a148298 commit 680412e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Plugin/resource/DataProvider/DataProviderEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ public function canonicalPath($path) {
*/
public function entityPreSave(\EntityDrupalWrapper $wrapper) {}

/**
* {@inheritdoc}
*/
public function entitySave(\EntityDrupalWrapper $wrapper) {
$wrapper->save();
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 680412e

Please sign in to comment.