diff options
Diffstat (limited to 'src/Wallabag/GroupBundle/Entity')
-rw-r--r-- | src/Wallabag/GroupBundle/Entity/Group.php | 14 | ||||
-rw-r--r-- | src/Wallabag/GroupBundle/Entity/Invitation.php | 5 | ||||
-rw-r--r-- | src/Wallabag/GroupBundle/Entity/UserGroup.php | 9 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/Wallabag/GroupBundle/Entity/Group.php b/src/Wallabag/GroupBundle/Entity/Group.php index 31c82837..28b0227c 100644 --- a/src/Wallabag/GroupBundle/Entity/Group.php +++ b/src/Wallabag/GroupBundle/Entity/Group.php | |||
@@ -13,9 +13,8 @@ use Wallabag\UserBundle\Entity\User; | |||
13 | */ | 13 | */ |
14 | class Group extends BaseGroup | 14 | class Group extends BaseGroup |
15 | { | 15 | { |
16 | |||
17 | /** | 16 | /** |
18 | * User Roles | 17 | * User Roles. |
19 | */ | 18 | */ |
20 | 19 | ||
21 | /** User can only preview presentations */ | 20 | /** User can only preview presentations */ |
@@ -34,7 +33,7 @@ class Group extends BaseGroup | |||
34 | const ROLE_ADMIN = 10; | 33 | const ROLE_ADMIN = 10; |
35 | 34 | ||
36 | /** | 35 | /** |
37 | * Group join access | 36 | * Group join access. |
38 | */ | 37 | */ |
39 | 38 | ||
40 | /** Any user can join the group */ | 39 | /** Any user can join the group */ |
@@ -99,9 +98,10 @@ class Group extends BaseGroup | |||
99 | { | 98 | { |
100 | $userObj = new ArrayCollection(); | 99 | $userObj = new ArrayCollection(); |
101 | foreach ($this->users as $userGroup) { | 100 | foreach ($this->users as $userGroup) { |
102 | /** @var UserGroup $userGroup */ | 101 | /* @var UserGroup $userGroup */ |
103 | $userObj->add($userGroup->getUser()); | 102 | $userObj->add($userGroup->getUser()); |
104 | } | 103 | } |
104 | |||
105 | return $userObj; | 105 | return $userObj; |
106 | } | 106 | } |
107 | 107 | ||
@@ -177,24 +177,26 @@ class Group extends BaseGroup | |||
177 | public function getRequests() | 177 | public function getRequests() |
178 | { | 178 | { |
179 | $requests = new ArrayCollection(); | 179 | $requests = new ArrayCollection(); |
180 | foreach ($this->users as $user) /** @var UserGroup $user */ | 180 | foreach ($this->users as $user) /* @var UserGroup $user */ |
181 | { | 181 | { |
182 | if (!$user->isAccepted()) { | 182 | if (!$user->isAccepted()) { |
183 | $requests->add($user->getUser()); | 183 | $requests->add($user->getUser()); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | |||
186 | return $requests; | 187 | return $requests; |
187 | } | 188 | } |
188 | 189 | ||
189 | public function getInvited() | 190 | public function getInvited() |
190 | { | 191 | { |
191 | $invited = new ArrayCollection(); | 192 | $invited = new ArrayCollection(); |
192 | foreach ($this->users as $userGroup) /** @var UserGroup $userGroup */ | 193 | foreach ($this->users as $userGroup) /* @var UserGroup $userGroup */ |
193 | { | 194 | { |
194 | if ($userGroup->getInvitation()) { | 195 | if ($userGroup->getInvitation()) { |
195 | $invited->add($userGroup); | 196 | $invited->add($userGroup); |
196 | } | 197 | } |
197 | } | 198 | } |
199 | |||
198 | return $invited; | 200 | return $invited; |
199 | } | 201 | } |
200 | } | 202 | } |
diff --git a/src/Wallabag/GroupBundle/Entity/Invitation.php b/src/Wallabag/GroupBundle/Entity/Invitation.php index 6946bede..e944b348 100644 --- a/src/Wallabag/GroupBundle/Entity/Invitation.php +++ b/src/Wallabag/GroupBundle/Entity/Invitation.php | |||
@@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM; | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @ORM\Entity | 8 | * @ORM\Entity |
9 | * @ORM\Table(name="invitation") | ||
9 | */ | 10 | */ |
10 | class Invitation | 11 | class Invitation |
11 | { | 12 | { |
@@ -42,7 +43,7 @@ class Invitation | |||
42 | /** | 43 | /** |
43 | * @return \DateTime | 44 | * @return \DateTime |
44 | */ | 45 | */ |
45 | public function getDate(): \DateTime | 46 | public function getDate() |
46 | { | 47 | { |
47 | return $this->date; | 48 | return $this->date; |
48 | } | 49 | } |
@@ -58,7 +59,7 @@ class Invitation | |||
58 | /** | 59 | /** |
59 | * @return mixed | 60 | * @return mixed |
60 | */ | 61 | */ |
61 | public function getUserGroup(): UserGroup | 62 | public function getUserGroup() |
62 | { | 63 | { |
63 | return $this->userGroup; | 64 | return $this->userGroup; |
64 | } | 65 | } |
diff --git a/src/Wallabag/GroupBundle/Entity/UserGroup.php b/src/Wallabag/GroupBundle/Entity/UserGroup.php index 22d1400a..0c40b0d3 100644 --- a/src/Wallabag/GroupBundle/Entity/UserGroup.php +++ b/src/Wallabag/GroupBundle/Entity/UserGroup.php | |||
@@ -3,15 +3,13 @@ | |||
3 | namespace Wallabag\GroupBundle\Entity; | 3 | namespace Wallabag\GroupBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 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; | 6 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
9 | use Wallabag\UserBundle\Entity\User; | 7 | use Wallabag\UserBundle\Entity\User; |
10 | 8 | ||
11 | /** | 9 | /** |
12 | * @ORM\Entity(repositoryClass="Wallabag\GroupBundle\Repository\UserGroupRepository") | 10 | * @ORM\Entity(repositoryClass="Wallabag\GroupBundle\Repository\UserGroupRepository") |
13 | * @UniqueEntity({"user_id", "group_id"}) | 11 | * @UniqueEntity({"user_id", "group_id"}) |
14 | * @ORM\Table(name="fos_user_group") | 12 | * @ORM\Table(name="user_group") |
15 | */ | 13 | */ |
16 | class UserGroup | 14 | class UserGroup |
17 | { | 15 | { |
@@ -52,7 +50,8 @@ class UserGroup | |||
52 | 50 | ||
53 | /** | 51 | /** |
54 | * UserGroup constructor. | 52 | * UserGroup constructor. |
55 | * @param User $user | 53 | * |
54 | * @param User $user | ||
56 | * @param Group $group | 55 | * @param Group $group |
57 | * @param $role | 56 | * @param $role |
58 | */ | 57 | */ |
@@ -90,11 +89,13 @@ class UserGroup | |||
90 | 89 | ||
91 | /** | 90 | /** |
92 | * @param int $role | 91 | * @param int $role |
92 | * | ||
93 | * @return UserGroup | 93 | * @return UserGroup |
94 | */ | 94 | */ |
95 | public function setRole($role) | 95 | public function setRole($role) |
96 | { | 96 | { |
97 | $this->role = $role; | 97 | $this->role = $role; |
98 | |||
98 | return $this; | 99 | return $this; |
99 | } | 100 | } |
100 | 101 | ||