]> git.agnieray.net Git - galette.git/commitdiff
Ensure user is logged to load subgroups; handle exception for pgsql
authorJohan Cwiklinski <johan@x-tnd.be>
Thu, 11 Nov 2021 08:23:25 +0000 (09:23 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Thu, 11 Nov 2021 09:05:07 +0000 (10:05 +0100)
galette/lib/Galette/Entity/Group.php

index 8603ad8fb33361522a635fc2789703cce363cb9f..85988a8c2c34eee63ad00c1661c9fbad0a979858 100644 (file)
@@ -223,6 +223,11 @@ class Group
     {
         global $zdb;
 
+        if (!isset($this->login) || !$this->login->isLogged()) {
+            $this->groups = [];
+            return;
+        }
+
         try {
             $select = $zdb->select(self::TABLE, 'a');
 
@@ -319,7 +324,7 @@ class Group
             if ($transaction) {
                 $zdb->connection->rollBack();
             }
-            if ($e->getCode() == 23000) {
+            if (!$zdb->isPostgres() && $e->getCode() == 23000 || $zdb->isPostgres() && $e->getCode() == 23503) {
                 Analog::log(
                     str_replace(
                         '%group',