summaryrefslogtreecommitdiffstats
path: root/lib/public/appframework/db/mapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/appframework/db/mapper.php')
-rw-r--r--lib/public/appframework/db/mapper.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php
index f65a232ed83..13a4c65e493 100644
--- a/lib/public/appframework/db/mapper.php
+++ b/lib/public/appframework/db/mapper.php
@@ -127,6 +127,12 @@ abstract class Mapper {
* @param Entity $entity the entity that should be created
*/
public function update(Entity $entity){
+ // if entity wasn't changed it makes no sense to run a db query
+ $properties = $entity->getUpdatedFields();
+ if(count($properties) === 0) {
+ return $entity;
+ }
+
// entity needs an id
$id = $entity->getId();
if($id === null){
@@ -136,7 +142,6 @@ abstract class Mapper {
// get updated fields to save, fields have to be set using a setter to
// be saved
- $properties = $entity->getUpdatedFields();
// dont update the id field
unset($properties['id']);