Finished ajaxUserData template
Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -27,6 +27,7 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
{
|
||||
$this->groups = new ArrayCollection();
|
||||
$this->roles = new ArrayCollection();
|
||||
$this->ledGroups = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,6 +349,46 @@ class User implements UserInterface, AdvancedUserInterface
|
||||
return $this->groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all groups, including led groups (which are sometimes not included
|
||||
* in $groups)
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getAllGroups()
|
||||
{
|
||||
$groups = $this->ledGroups;
|
||||
|
||||
$this->getGroups()->forAll(function($i, $membership) use ($groups) {
|
||||
$group = $membership->getGroup();
|
||||
if ($groups->contains($group)) {
|
||||
return true;
|
||||
}
|
||||
$groups->add($group);
|
||||
return true;
|
||||
});
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups led by this User
|
||||
*
|
||||
* @var Doctrine\Common\Collections\ArrayCollection $ledGroups
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="leader", fetch="LAZY")
|
||||
*/
|
||||
protected $ledGroups;
|
||||
|
||||
/**
|
||||
* Get ledGroups
|
||||
*
|
||||
* @return Doctrine\Common\Collections\ArrayCollection
|
||||
*/
|
||||
public function getLedGroups()
|
||||
{
|
||||
return $this->ledGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Roles belonging to this User
|
||||
*
|
||||
|
Reference in New Issue
Block a user