]> git.agnieray.net Git - galette.git/blobdiff - galette/lib/Galette/Entity/Group.php
Add tests on Group entity and repository
[galette.git] / galette / lib / Galette / Entity / Group.php
index 85988a8c2c34eee63ad00c1661c9fbad0a979858..cfedcc315d0d8a06ddb1c1a2641b2e26cc744e34 100644 (file)
@@ -133,7 +133,7 @@ class Group
      */
     private function loadFromRS($r)
     {
-        $this->id = $r->id_group;
+        $this->id = (int)$r->id_group;
         $this->group_name = $r->group_name;
         $this->creation_date = $r->creation_date;
         if ($r->parent_group) {
@@ -485,10 +485,13 @@ class Group
             return true;
         } else {
             //let's check if current logged-in user is part of group managers
+            if (!is_array($this->managers)) {
+                $this->loadPersons(self::MANAGER_TYPE);
+            }
+
             foreach ($this->managers as $manager) {
                 if ($login->login == $manager->login) {
                     return true;
-                    break;
                 }
             }
             return false;
@@ -655,19 +658,6 @@ class Group
         return $this;
     }
 
-    /**
-     * Set all subgroups
-     *
-     * @param array $groups Groups id
-     *
-     * @return Group
-     */
-    public function setSubgroups($groups)
-    {
-        $this->groups = $groups;
-        return $this;
-    }
-
     /**
      * check if can Set parent group
      *