3 namespace Wallabag\GroupBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use FOS\UserBundle\Model\GroupInterface
;
7 use Symfony\Component\Validator\Constraints
as Assert
;
8 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity
;
9 use Wallabag\UserBundle\Entity\User
;
12 * @ORM\Entity(repositoryClass="Wallabag\GroupBundle\Repository\UserGroupRepository")
13 * @UniqueEntity({"user_id", "group_id"})
14 * @ORM\Table(name="fos_user_group")
19 * @ORM\Column(name="id", type="integer")
21 * @ORM\GeneratedValue(strategy="AUTO")
26 * @ORM\Column(name="role", type="integer")
31 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="userGroups")
32 * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
37 * @ORM\ManyToOne(targetEntity="Wallabag\GroupBundle\Entity\Group", inversedBy="users")
38 * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
43 * @ORM\Column(name="accepted", type="boolean", options={"default" : false})
48 * @ORM\OneToOne(targetEntity="Wallabag\GroupBundle\Entity\Invitation", inversedBy="userGroup", cascade={"persist", "remove"})
49 * @ORM\JoinColumn(name="invitation", referencedColumnName="code")
51 protected $invitation;
54 * UserGroup constructor.
59 public function __construct(User
$user, Group
$group, $role, $request = false)
62 $this->group
= $group;
64 $this->accepted
= $request;
70 public function getGroup()
78 public function getRole()
86 public function getUser()
95 public function setRole($role)
102 * @param bool $accepted
104 public function setAccepted($accepted)
106 $this->accepted
= $accepted;
112 public function isAccepted()
114 return $this->accepted
;
117 public function setInvitation($invitation)
119 $this->invitation
= $invitation;
122 public function getInvitation()
124 return $this->invitation
;