vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/Group.php line 26

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\SecurityBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use JMS\Serializer\Annotation\Exclude;
  14. use Sulu\Bundle\CoreBundle\Entity\ApiEntity;
  15. use Sulu\Component\Persistence\Model\AuditableInterface;
  16. use Sulu\Component\Persistence\Model\AuditableTrait;
  17. use Sulu\Component\Security\Authentication\RoleInterface;
  18. use Sulu\Component\Security\Authentication\UserInterface;
  19. /**
  20.  * @deprecated The group functionality was deprecated in Sulu 2.1 and will be removed in Sulu 3.0
  21.  */
  22. class Group extends ApiEntity implements AuditableInterface
  23. {
  24.     use AuditableTrait;
  25.     /**
  26.      * @var int
  27.      *
  28.      * @Exclude
  29.      */
  30.     private $lft;
  31.     /**
  32.      * @var int
  33.      *
  34.      * @Exclude
  35.      */
  36.     private $rgt;
  37.     /**
  38.      * @var int
  39.      *
  40.      * @Exclude
  41.      */
  42.     private $depth;
  43.     /**
  44.      * @var string
  45.      */
  46.     private $name;
  47.     /**
  48.      * @var int
  49.      */
  50.     private $id;
  51.     /**
  52.      * @var Collection<int, self>
  53.      */
  54.     private $children;
  55.     /**
  56.      * @var Collection<int, UserGroup>
  57.      */
  58.     private $userGroups;
  59.     /**
  60.      * @var Group|null
  61.      */
  62.     private $parent;
  63.     /**
  64.      * @var Collection<int, RoleInterface>
  65.      */
  66.     private $roles;
  67.     /**
  68.      * @var UserInterface|null
  69.      *
  70.      * @Exclude
  71.      */
  72.     protected $changer;
  73.     /**
  74.      * @var UserInterface|null
  75.      *
  76.      * @Exclude
  77.      */
  78.     protected $creator;
  79.     public function __construct()
  80.     {
  81.         $this->children = new ArrayCollection();
  82.         $this->userGroups = new ArrayCollection();
  83.         $this->roles = new ArrayCollection();
  84.     }
  85.     /**
  86.      * Set lft.
  87.      *
  88.      * @param int $lft
  89.      *
  90.      * @return Group
  91.      */
  92.     public function setLft($lft)
  93.     {
  94.         $this->lft $lft;
  95.         return $this;
  96.     }
  97.     /**
  98.      * Get lft.
  99.      *
  100.      * @return int
  101.      */
  102.     public function getLft()
  103.     {
  104.         return $this->lft;
  105.     }
  106.     /**
  107.      * Set rgt.
  108.      *
  109.      * @param int $rgt
  110.      *
  111.      * @return Group
  112.      */
  113.     public function setRgt($rgt)
  114.     {
  115.         $this->rgt $rgt;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Get rgt.
  120.      *
  121.      * @return int
  122.      */
  123.     public function getRgt()
  124.     {
  125.         return $this->rgt;
  126.     }
  127.     /**
  128.      * Set depth.
  129.      *
  130.      * @param int $depth
  131.      *
  132.      * @return Group
  133.      */
  134.     public function setDepth($depth)
  135.     {
  136.         $this->depth $depth;
  137.         return $this;
  138.     }
  139.     /**
  140.      * Get depth.
  141.      *
  142.      * @return int
  143.      */
  144.     public function getDepth()
  145.     {
  146.         return $this->depth;
  147.     }
  148.     /**
  149.      * Set name.
  150.      *
  151.      * @param string $name
  152.      *
  153.      * @return Group
  154.      */
  155.     public function setName($name)
  156.     {
  157.         $this->name $name;
  158.         return $this;
  159.     }
  160.     /**
  161.      * Get name.
  162.      *
  163.      * @return string
  164.      */
  165.     public function getName()
  166.     {
  167.         return $this->name;
  168.     }
  169.     /**
  170.      * Get id.
  171.      *
  172.      * @return int
  173.      */
  174.     public function getId()
  175.     {
  176.         return $this->id;
  177.     }
  178.     /**
  179.      * Add children.
  180.      *
  181.      * @return Group
  182.      */
  183.     public function addChildren(self $children)
  184.     {
  185.         $this->children[] = $children;
  186.         return $this;
  187.     }
  188.     /**
  189.      * Remove children.
  190.      *
  191.      * @return void
  192.      */
  193.     public function removeChildren(self $children)
  194.     {
  195.         $this->children->removeElement($children);
  196.     }
  197.     /**
  198.      * Get children.
  199.      *
  200.      * @return Collection<int, self>
  201.      */
  202.     public function getChildren()
  203.     {
  204.         return $this->children;
  205.     }
  206.     /**
  207.      * Add userGroups.
  208.      *
  209.      * @return Group
  210.      */
  211.     public function addUserGroup(UserGroup $userGroups)
  212.     {
  213.         $this->userGroups[] = $userGroups;
  214.         return $this;
  215.     }
  216.     /**
  217.      * Remove userGroups.
  218.      *
  219.      * @return void
  220.      */
  221.     public function removeUserGroup(UserGroup $userGroups)
  222.     {
  223.         $this->userGroups->removeElement($userGroups);
  224.     }
  225.     /**
  226.      * Get userGroups.
  227.      *
  228.      * @return Collection<int, UserGroup>
  229.      */
  230.     public function getUserGroups()
  231.     {
  232.         return $this->userGroups;
  233.     }
  234.     /**
  235.      * Set parent.
  236.      *
  237.      * @return Group
  238.      */
  239.     public function setParent(self $parent null)
  240.     {
  241.         $this->parent $parent;
  242.         return $this;
  243.     }
  244.     /**
  245.      * Get parent.
  246.      *
  247.      * @return Group|null
  248.      */
  249.     public function getParent()
  250.     {
  251.         return $this->parent;
  252.     }
  253.     /**
  254.      * Add roles.
  255.      *
  256.      * @return Group
  257.      */
  258.     public function addRole(RoleInterface $roles)
  259.     {
  260.         $this->roles[] = $roles;
  261.         return $this;
  262.     }
  263.     /**
  264.      * Remove roles.
  265.      *
  266.      * @return void
  267.      */
  268.     public function removeRole(RoleInterface $roles)
  269.     {
  270.         $this->roles->removeElement($roles);
  271.     }
  272.     /**
  273.      * Get roles.
  274.      *
  275.      * @return Collection<int, RoleInterface>
  276.      */
  277.     public function getRoles()
  278.     {
  279.         return $this->roles;
  280.     }
  281. }