aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/Db/QBMapper.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php
index a6c8ac27acb..5fa367491b0 100644
--- a/lib/public/AppFramework/Db/QBMapper.php
+++ b/lib/public/AppFramework/Db/QBMapper.php
@@ -89,9 +89,11 @@ abstract class QBMapper {
public function delete(Entity $entity): Entity {
$qb = $this->db->getQueryBuilder();
+ $idType = $this->getParameterTypeForProperty($entity, 'id');
+
$qb->delete($this->tableName)
->where(
- $qb->expr()->eq('id', $qb->createNamedParameter($entity->getId()))
+ $qb->expr()->eq('id', $qb->createNamedParameter($entity->getId(), $idType))
);
$qb->execute();
return $entity;
@@ -126,6 +128,7 @@ abstract class QBMapper {
$qb->execute();
if($entity->id === null) {
+ // When autoincrement is used id is always an int
$entity->setId((int)$qb->getLastInsertId());
}
@@ -191,8 +194,10 @@ abstract class QBMapper {
$qb->set($column, $qb->createNamedParameter($value, $type));
}
+ $idType = $this->getParameterTypeForProperty($entity, 'id');
+
$qb->where(
- $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))
+ $qb->expr()->eq('id', $qb->createNamedParameter($id, $idType))
);
$qb->execute();