From a4d8e6334eeed8b7e8d552bf72b94f834ca08e2f Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Fri, 28 Oct 2016 23:24:40 +0200 Subject: [PATCH] Update only fields with changes --- lib/Db/CardMapper.php | 5 ----- lib/Db/Entity.php | 11 +---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php index b559b1ee4..9a6ef4b18 100644 --- a/lib/Db/CardMapper.php +++ b/lib/Db/CardMapper.php @@ -44,16 +44,11 @@ class CardMapper extends DeckMapper implements IPermissionMapper { return parent::insert($entity); } - /** - * @param Entity $entity - * @return Entity - */ public function update(Entity $entity) { $entity->setLastModified(time()); return parent::update($entity); } - /** * @param $id * @return Entity if not found diff --git a/lib/Db/Entity.php b/lib/Db/Entity.php index f804eedd0..0bafe5b75 100644 --- a/lib/Db/Entity.php +++ b/lib/Db/Entity.php @@ -34,7 +34,6 @@ namespace OCA\Deck\Db; class Entity extends \OCP\AppFramework\Db\Entity { private $_relations = array(); - private $_updatedFields = array(); /** * Mark a property as relation so it will not get updated using Mapper::update @@ -53,16 +52,8 @@ class Entity extends \OCP\AppFramework\Db\Entity { */ protected function markFieldUpdated($attribute){ if(!in_array($attribute, $this->_relations)) { - $this->_updatedFields[$attribute] = true; + parent::markFieldUpdated($attribute); } } - /** - * overwritten from \OCP\AppFramework\Db\Entity to avoid writing relational attributes - * @return array Array of field's update status - */ - public function getUpdatedFields(){ - return $this->_updatedFields; - } - } \ No newline at end of file