diff --git a/lib/Db/ObjectEntityMapper.php b/lib/Db/ObjectEntityMapper.php index 8a82cb6..a30aad9 100644 --- a/lib/Db/ObjectEntityMapper.php +++ b/lib/Db/ObjectEntityMapper.php @@ -45,7 +45,7 @@ class ObjectEntityMapper extends QBMapper * @param IUserSession $userSession The user session */ public function __construct( - IDBConnection $db, + IDBConnection $db, MySQLJsonService $mySQLJsonService, IEventDispatcher $eventDispatcher, IUserSession $userSession, @@ -73,7 +73,7 @@ public function find($identifier): ObjectEntity ->from('openregister_objects') ->where( $qb->expr()->orX( - $qb->expr()->eq('id', $qb->createNamedParameter($identifier, IQueryBuilder::PARAM_INT)), + $qb->expr()->eq('id', $qb->createNamedParameter(is_numeric($identifier) ? $identifier : -1, IQueryBuilder::PARAM_INT)), $qb->expr()->eq('uuid', $qb->createNamedParameter($identifier, IQueryBuilder::PARAM_STR)), $qb->expr()->eq('uri', $qb->createNamedParameter($identifier, IQueryBuilder::PARAM_STR)) ) @@ -469,10 +469,10 @@ public function lockObject($identifier, ?string $process = null, ?int $duration * @throws DoesNotExistException If object not found * @throws \Exception If unlocking fails */ - public function unlockObject($identifier): ObjectEntity + public function unlockObject($identifier): ObjectEntity { $object = $this->find($identifier); - + // Check if user has permission to unlock if (!$this->userSession->isLoggedIn()) { throw new \Exception('Must be logged in to unlock objects');