Update only fields with changes

This commit is contained in:
Julius Haertl
2016-10-28 23:24:40 +02:00
parent d16c767017
commit a4d8e6334e
2 changed files with 1 additions and 15 deletions

View File

@@ -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

View File

@@ -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;
}
}