]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Repository/ClientRepository.php
Merge pull request #3831 from wallabag/fix/api-bad-client-id
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Repository / ClientRepository.php
diff --git a/src/Wallabag/ApiBundle/Repository/ClientRepository.php b/src/Wallabag/ApiBundle/Repository/ClientRepository.php
new file mode 100644 (file)
index 0000000..fc14262
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+namespace Wallabag\ApiBundle\Repository;
+
+use Doctrine\ORM\EntityRepository;
+
+class ClientRepository extends EntityRepository
+{
+    public function findOneBy(array $criteria, array $orderBy = null)
+    {
+        if (!empty($criteria['id'])) {
+            // cast client id to be an integer to avoid postgres error:
+            // "invalid input syntax for integer"
+            $criteria['id'] = (int) $criteria['id'];
+        }
+
+        return parent::findOneBy($criteria, $orderBy);
+    }
+}