Issues (279)

api/src/Entity/User.php (38 issues)

1
<?php
2
3
namespace App\Entity;
4
5
use App\Entity\Attribute\Accessor as EntityAccessor;
6
use DateTime;
7
use Ds\Component\Model\Type\Deletable;
0 ignored issues
show
The type Ds\Component\Model\Type\Deletable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Ds\Component\Model\Type\Identifiable;
0 ignored issues
show
The type Ds\Component\Model\Type\Identifiable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Ds\Component\Model\Type\Uuidentifiable;
0 ignored issues
show
The type Ds\Component\Model\Type\Uuidentifiable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Ds\Component\Model\Type\Ownable;
0 ignored issues
show
The type Ds\Component\Model\Type\Ownable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Ds\Component\Model\Type\Identitiable;
0 ignored issues
show
The type Ds\Component\Model\Type\Identitiable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Ds\Component\Model\Type\Versionable;
0 ignored issues
show
The type Ds\Component\Model\Type\Versionable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Ds\Component\Model\Attribute\Accessor;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Ds\Component\Tenant\Model\Attribute\Accessor as TenantAccessor;
0 ignored issues
show
The type Ds\Component\Tenant\Model\Attribute\Accessor was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Ds\Component\Tenant\Model\Type\Tenantable;
0 ignored issues
show
The type Ds\Component\Tenant\Model\Type\Tenantable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use FOS\UserBundle\Model\User as BaseUser;
0 ignored issues
show
The type FOS\UserBundle\Model\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use FOS\UserBundle\Model\UserInterface;
0 ignored issues
show
The type FOS\UserBundle\Model\UserInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Knp\DoctrineBehaviors\Model as Behavior;
0 ignored issues
show
The type Knp\DoctrineBehaviors\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
20
use ApiPlatform\Core\Annotation\ApiResource;
0 ignored issues
show
The type ApiPlatform\Core\Annotation\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use ApiPlatform\Core\Annotation\ApiProperty;
0 ignored issues
show
The type ApiPlatform\Core\Annotation\ApiProperty was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
use Symfony\Bridge\Doctrine\Validator\Constraints as ORMAssert;
0 ignored issues
show
The type Symfony\Bridge\Doctrine\Validator\Constraints was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use Symfony\Component\Serializer\Annotation As Serializer;
0 ignored issues
show
The type Symfony\Component\Serializer\Annotation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use Symfony\Component\Validator\Constraints as Assert;
0 ignored issues
show
The type Symfony\Component\Validator\Constraints was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
27
/**
28
 * @ApiResource(
29
 *     attributes={
30
 *         "normalization_context"={
31
 *             "groups"={"user_output"}
32
 *         },
33
 *         "denormalization_context"={
34
 *             "groups"={"user_input"}
35
 *         },
36
 *         "filters"={
37
 *             "app.user.search",
38
 *             "app.user.date",
39
 *             "app.user.boolean",
40
 *             "app.user.order"
41
 *         }
42
 *     }
43
 * )
44
 * @ORM\Entity
45
 * @ORM\Table(
46
 *     name="app_user",
47
 *     uniqueConstraints={
48
 *        @ORM\UniqueConstraint(columns={"username", "tenant"}),
49
 *        @ORM\UniqueConstraint(columns={"username_canonical", "tenant"}),
50
 *        @ORM\UniqueConstraint(columns={"email", "tenant"}),
51
 *        @ORM\UniqueConstraint(columns={"email_canonical", "tenant"})
52
 *     }
53
 * )
54
 * @ORM\AttributeOverrides({
55
 *     @ORM\AttributeOverride(
56
 *         name="usernameCanonical",
57
 *         column=@ORM\Column(type="string", name="username_canonical", length=180, unique=false)
58
 *     ),
59
 *     @ORM\AttributeOverride(
60
 *         name="emailCanonical",
61
 *         column=@ORM\Column(type="string", name="email_canonical", length=180, unique=false)
62
 *     )
63
 * })
64
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
65
 * @ORMAssert\UniqueEntity(fields="uuid")
66
 * @ORMAssert\UniqueEntity(fields={"username", "tenant"})
67
 * @ORMAssert\UniqueEntity(fields={"usernameCanonical", "tenant"})
68
 * @ORMAssert\UniqueEntity(fields={"email", "tenant"})
69
 * @ORMAssert\UniqueEntity(fields={"emailCanonical", "tenant"})
70
 */
71
class User extends BaseUser implements Identifiable, Uuidentifiable, Ownable, Identitiable, Deletable, Versionable, Tenantable
72
{
73
    use Behavior\Timestampable\Timestampable;
0 ignored issues
show
The type Knp\DoctrineBehaviors\Mo...stampable\Timestampable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
74
    use Behavior\SoftDeletable\SoftDeletable;
0 ignored issues
show
The type Knp\DoctrineBehaviors\Mo...Deletable\SoftDeletable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
75
76
    use Accessor\Id;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Id was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
77
    use Accessor\Uuid;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Uuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
78
    use Accessor\Owner;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Owner was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
79
    use Accessor\OwnerUuid;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\OwnerUuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
80
    use Accessor\Identity;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Identity was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
81
    use Accessor\IdentityUuid;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\IdentityUuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
82
    use EntityAccessor\Registration;
83
    use Accessor\Deleted;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Deleted was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
84
    use Accessor\Version;
0 ignored issues
show
The type Ds\Component\Model\Attribute\Accessor\Version was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
85
    use TenantAccessor\Tenant;
0 ignored issues
show
The type Ds\Component\Tenant\Mode...tribute\Accessor\Tenant was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
86
87
    /**
88
     * @var integer
89
     * @ApiProperty(identifier=false, writable=false)
90
     * @Serializer\Groups({"user_output"})
91
     * @ORM\Id
92
     * @ORM\GeneratedValue(strategy="AUTO")
93
     * @ORM\Column(name="id", type="integer")
94
     */
95
    protected $id;
96
97
    /**
98
     * @var string
99
     * @ApiProperty(identifier=true, writable=false)
100
     * @Serializer\Groups({"user_output"})
101
     * @ORM\Column(name="uuid", type="guid", unique=true)
102
     * @Assert\Uuid
103
     */
104
    private $uuid;
0 ignored issues
show
The private property $uuid is not used, and could be removed.
Loading history...
105
106
    /**
107
     * @var \DateTime
108
     * @ApiProperty(writable=false)
109
     * @Serializer\Groups({"user_output"})
110
     */
111
    protected $createdAt;
112
113
    /**
114
     * @var \DateTime
115
     * @ApiProperty(writable=false)
116
     * @Serializer\Groups({"user_output"})
117
     */
118
    protected $updatedAt;
119
120
    /**
121
     * @var \DateTime
122
     * @ApiProperty(writable=false)
123
     * @Serializer\Groups({"user_output"})
124
     */
125
    protected $deletedAt;
126
127
    /**
128
     * @var string
129
     * @ApiProperty
130
     * @Serializer\Groups({"user_output", "user_input"})
131
     * @Assert\NotBlank
132
     * @Assert\Length(min=1, max=255)
133
     */
134
    protected $username;
135
136
    /**
137
     * @var string
138
     * @ApiProperty(readable=false)
139
     * @Serializer\Groups({"user_input"})
140
     */
141
    protected $plainPassword;
142
143
    /**
144
     * @var string
145
     * @ApiProperty
146
     * @Serializer\Groups({"user_output", "user_input"})
147
     * @Assert\NotBlank
148
     * @Assert\Length(min=1, max=255)
149
     * @Assert\Regex("/^.+@.+$/")
150
     */
151
    protected $email;
152
153
    /**
154
     * @var boolean
155
     * @ApiProperty
156
     * @Serializer\Groups({"user_output", "user_input"})
157
     * @Assert\Type("boolean")
158
     */
159
    protected $enabled;
160
161
    /**
162
     * @var \DateTime
163
     */
164
    protected $lastLogin; # region accessors
165
166
    /**
167
     * {@inheritdoc}
168
     */
169
    public function setLastLogin(DateTime $time = null)
170
    {
171
        // Disable last login by always setting it to null. This avoids a version bump due to login in.
172
        $this->lastLogin = null;
173
174
        return $this;
175
    }
176
177
    # endregion
178
179
    /**
180
     * @var \Doctrine\Common\Collections\Collection
0 ignored issues
show
The type Doctrine\Common\Collections\Collection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
181
     * @ApiProperty
182
     * @Serializer\Groups({"user_output", "user_input"})
183
     */
184
    protected $groups;
185
186
    /**
187
     * @var array
188
     * @ApiProperty
189
     * @Serializer\Groups({"user_output", "user_input"})
190
     * @Assert\Type("array")
191
     * @Assert\All({
192
     *     @Assert\NotBlank,
193
     *     @Assert\Length(min=1)
194
     * })
195
     */
196
    protected $roles;
197
198
    /**
199
     * @var string
200
     * @ApiProperty
201
     * @Serializer\Groups({"user_output", "user_input"})
202
     * @ORM\Column(name="`owner`", type="string", length=255, nullable=true)
203
     * @Assert\NotBlank
204
     * @Assert\Length(min=1, max=255)
205
     */
206
    private $owner;
0 ignored issues
show
The private property $owner is not used, and could be removed.
Loading history...
207
208
    /**
209
     * @var string
210
     * @ApiProperty
211
     * @Serializer\Groups({"user_output", "user_input"})
212
     * @ORM\Column(name="owner_uuid", type="guid", nullable=true)
213
     * @Assert\NotBlank
214
     * @Assert\Uuid
215
     */
216
    private $ownerUuid;
0 ignored issues
show
The private property $ownerUuid is not used, and could be removed.
Loading history...
217
218
    /**
219
     * @var string
220
     * @ApiProperty
221
     * @Serializer\Groups({"user_output", "user_input"})
222
     * @ORM\Column(name="identity", type="string", length=255, nullable=true)
223
     * @Assert\NotBlank
224
     * @Assert\Length(min=1, max=255)
225
     */
226
    private $identity;
0 ignored issues
show
The private property $identity is not used, and could be removed.
Loading history...
227
228
    /**
229
     * @var string
230
     * @ApiProperty
231
     * @Serializer\Groups({"user_output", "user_input"})
232
     * @ORM\Column(name="identity_uuid", type="guid", nullable=true)
233
     * @Assert\Uuid
234
     */
235
    private $identityUuid;
0 ignored issues
show
The private property $identityUuid is not used, and could be removed.
Loading history...
236
237
    /**
238
     * @var \App\Entity\Registration
239
     * @ORM\OneToOne(targetEntity="Registration", mappedBy="user")
240
     * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
241
     */
242
    private $registration;
0 ignored issues
show
The private property $registration is not used, and could be removed.
Loading history...
243
244
    /**
245
     * @var integer
246
     * @ApiProperty
247
     * @Serializer\Groups({"user_output", "user_input"})
248
     * @ORM\Column(name="version", type="integer")
249
     * @ORM\Version
250
     * @Assert\NotBlank
251
     * @Assert\Type("integer")
252
     */
253
    private $version;
0 ignored issues
show
The private property $version is not used, and could be removed.
Loading history...
254
255
    /**
256
     * @var string
257
     * @ApiProperty(writable=false)
258
     * @Serializer\Groups({"user_output"})
259
     * @ORM\Column(name="tenant", type="guid")
260
     * @Assert\Uuid
261
     */
262
    private $tenant;
0 ignored issues
show
The private property $tenant is not used, and could be removed.
Loading history...
263
264
    /**
265
     * Check if user is user
266
     *
267
     * @param \FOS\UserBundle\Model\UserInterface $user
268
     * @return boolean
269
     */
270
    public function isUser(UserInterface $user = null)
271
    {
272
        return $user instanceof self && $user->id === $this->id;
273
    }
274
}
275