]> git.agnieray.net Git - galette.git/blobdiff - galette/lib/Galette/Entity/Group.php
Fix accordion when groups contains " / "
[galette.git] / galette / lib / Galette / Entity / Group.php
index 3e3d3553adb7302f4522167abf37d9ffb53246e7..41b1aa411a2b68ae91647e5149d49df74abe529e 100644 (file)
@@ -550,6 +550,22 @@ class Group
         return $this->group_name;
     }
 
+    /**
+     * Get parents as an array
+     *
+     * @return array
+     */
+    public function getParents(): array
+    {
+        $parents = [];
+        $group = $this;
+        while ($group = $group->getParentGroup()) {
+            $parents[] = $group->getName();
+        }
+        return $parents;
+    }
+
+
     /**
      * Get the indented short name of the group "  >> bar"
      *
@@ -615,7 +631,7 @@ class Group
     /**
      * Get parent group
      *
-     * @return Group
+     * @return Group|null
      */
     public function getParentGroup()
     {
@@ -689,7 +705,6 @@ class Group
             }
         } while ($group = $group->getParentGroup());
 
-        //@phpstan-ignore-next-line
         return true;
     }