according to PHPDoc this function shall return the entity
This commit is contained in:
parent
4c79d34980
commit
c08a1e6455
|
@ -125,6 +125,7 @@ abstract class Mapper {
|
||||||
* Updates an entry in the db from an entity
|
* Updates an entry in the db from an entity
|
||||||
* @throws \InvalidArgumentException if entity has no id
|
* @throws \InvalidArgumentException if entity has no id
|
||||||
* @param Entity $entity the entity that should be created
|
* @param Entity $entity the entity that should be created
|
||||||
|
* @return Entity the saved entity with the set id
|
||||||
*/
|
*/
|
||||||
public function update(Entity $entity){
|
public function update(Entity $entity){
|
||||||
// if entity wasn't changed it makes no sense to run a db query
|
// if entity wasn't changed it makes no sense to run a db query
|
||||||
|
@ -142,7 +143,7 @@ abstract class Mapper {
|
||||||
|
|
||||||
// get updated fields to save, fields have to be set using a setter to
|
// get updated fields to save, fields have to be set using a setter to
|
||||||
// be saved
|
// be saved
|
||||||
// dont update the id field
|
// do not update the id field
|
||||||
unset($properties['id']);
|
unset($properties['id']);
|
||||||
|
|
||||||
$columns = '';
|
$columns = '';
|
||||||
|
@ -171,6 +172,8 @@ abstract class Mapper {
|
||||||
array_push($params, $id);
|
array_push($params, $id);
|
||||||
|
|
||||||
$this->execute($sql, $params);
|
$this->execute($sql, $params);
|
||||||
|
|
||||||
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue