2
2
3
3
namespace App \Entity ;
4
4
5
+ use ApiPlatform \Doctrine \Orm \Filter \SearchFilter ;
6
+ use ApiPlatform \Metadata \ApiFilter ;
5
7
use ApiPlatform \Metadata \ApiResource ;
6
8
use ApiPlatform \Metadata \Delete ;
7
9
use ApiPlatform \Metadata \Get ;
8
10
use ApiPlatform \Metadata \GetCollection ;
9
11
use ApiPlatform \Metadata \Patch ;
12
+ use App \ApiPlatform \IsStudentFilter ;
13
+ use App \ApiPlatform \SearchInNamesFilter ;
14
+ use App \ApiPlatform \UEFilter ;
10
15
use App \Controller \GetEDTController ;
11
16
use App \Controller \SoftDeleteController ;
12
17
use App \DataProvider \UserDataVisibilityItemDataProvider ;
24
29
* The main entity that represents all Users. It is related to UEs, Covoits, Assos and others.
25
30
*
26
31
* @ORM\Entity(repositoryClass=UserRepository::class)
32
+ *
27
33
* @ORM\Table(name="users")
28
34
*/
29
35
#[
58
64
],
59
65
paginationItemsPerPage: 10 ,
60
66
security: "is_granted('ROLE_USER') " ,
61
- )
67
+ ),
68
+ ApiFilter(
69
+ SearchFilter::class,
70
+ properties: [
71
+ 'studentId ' => 'exact ' ,
72
+ 'mailsPhones.mailPersonal ' => 'exact ' ,
73
+ 'mailsPhones.phoneNumber ' => 'exact ' ,
74
+ 'branche.branche.code ' => 'exact ' ,
75
+ 'branche.filiere.code ' => 'exact ' ,
76
+ 'branche.semesterNumber ' => 'exact ' ,
77
+ ]
78
+ ),
79
+ ApiFilter(UEFilter::class),
80
+ ApiFilter(SearchInNamesFilter::class),
81
+ ApiFilter(IsStudentFilter::class),
62
82
]
63
83
class User implements UserInterface
64
84
{
65
85
/**
66
86
* @ORM\Id
87
+ *
67
88
* @ORM\Column(type="uuid", unique=true)
89
+ *
68
90
* @ORM\GeneratedValue(strategy="CUSTOM")
91
+ *
69
92
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
93
+ *
70
94
* @Assert\Uuid()
71
95
*/
72
96
#[Groups([
@@ -79,8 +103,11 @@ class User implements UserInterface
79
103
* The CAS login of the User.
80
104
*
81
105
* @ORM\Column(type="string", length=50, unique=true)
106
+ *
82
107
* @Assert\Type("string")
108
+ *
83
109
* @Assert\Length(max=50)
110
+ *
84
111
* @Assert\Regex("/^[a-z_0-9]{1,50}$/")
85
112
*/
86
113
#[Groups([
@@ -93,7 +120,9 @@ class User implements UserInterface
93
120
* For the User that are students, this is the UTT student number.
94
121
*
95
122
* @ORM\Column(type="integer", nullable=true, unique=true)
123
+ *
96
124
* @Assert\Type("int")
125
+ *
97
126
* @Assert\Positive
98
127
*/
99
128
#[Groups([
@@ -103,7 +132,9 @@ class User implements UserInterface
103
132
104
133
/**
105
134
* @ORM\Column(type="string", length=255)
135
+ *
106
136
* @Assert\Type("string")
137
+ *
107
138
* @Assert\Length(max=255)
108
139
*/
109
140
#[Groups([
@@ -114,7 +145,9 @@ class User implements UserInterface
114
145
115
146
/**
116
147
* @ORM\Column(type="string", length=255)
148
+ *
117
149
* @Assert\Type("string")
150
+ *
118
151
* @Assert\Length(max=255)
119
152
*/
120
153
#[Groups([
@@ -141,6 +174,7 @@ class User implements UserInterface
141
174
* The relation to the entity that contains the User's SocialNetwork.
142
175
*
143
176
* @ORM\OneToOne(targetEntity=UserSocialNetwork::class, mappedBy="user", cascade={"persist", "remove"})
177
+ *
144
178
* @Assert\Valid()
145
179
*/
146
180
#[Groups([
@@ -160,6 +194,7 @@ class User implements UserInterface
160
194
* The relation to the entity that contains the User's RGPD.
161
195
*
162
196
* @ORM\OneToOne(targetEntity=UserRGPD::class, mappedBy="user", cascade={"persist", "remove"})
197
+ *
163
198
* @Assert\Valid()
164
199
*/
165
200
#[Groups([
@@ -244,6 +279,7 @@ class User implements UserInterface
244
279
* The relation to the Preference of the User.
245
280
*
246
281
* @ORM\OneToOne(targetEntity=UserPreference::class, mappedBy="user", cascade={"persist", "remove"})
282
+ *
247
283
* @Assert\Valid()
248
284
*/
249
285
#[Groups([
@@ -256,6 +292,7 @@ class User implements UserInterface
256
292
* The relation to the Infos of the User.
257
293
*
258
294
* @ORM\OneToOne(targetEntity=UserInfos::class, mappedBy="user", cascade={"persist", "remove"})
295
+ *
259
296
* @Assert\Valid()
260
297
*/
261
298
#[Groups([
@@ -269,6 +306,7 @@ class User implements UserInterface
269
306
* The relation to the Addresses of the User.
270
307
*
271
308
* @ORM\OneToMany(targetEntity=UserAddress::class, mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
309
+ *
272
310
* @Assert\Valid()
273
311
*/
274
312
#[Groups([
@@ -281,6 +319,7 @@ class User implements UserInterface
281
319
* The relation to mails and phone number of the User.
282
320
*
283
321
* @ORM\OneToOne(targetEntity=UserMailsPhones::class, mappedBy="user", cascade={"persist", "remove"})
322
+ *
284
323
* @Assert\Valid()
285
324
*/
286
325
#[Groups([
0 commit comments