User
in package
implements
UserInterface, PasswordAuthenticatedUserInterface
Compte utilisateur de l'application (client individuel, employé d'entreprise ou administrateur).
Implémente UserInterface et PasswordAuthenticatedUserInterface pour s'intégrer au
composant Security de Symfony ; getUserIdentifier() retourne l'e-mail. Deux drapeaux
distincts conditionnent l'accès : isVerified (adresse e-mail confirmée, via le parcours de
vérification par code à six chiffres ou par lien signé selon le point d'entrée) et
isActivated (compte autorisé à se connecter par un administrateur) — UserAuthenticator,
GoogleAuthenticator et FacebookAuthenticator vérifient les deux avant de laisser passer une
connexion, tout comme AuthApiController côté API.
Relations : plusieurs Order (orders, one-to-many), plusieurs BusinessCardAize
(businessCardAizes, one-to-many — également exposées sous l'alias getCards() pour
compatibilité avec PlanService), plusieurs Payment (payments, one-to-many), plusieurs
Subscription (subscriptions, one-to-many), plusieurs Contact (contacts, one-to-many
avec orphan removal), et une entreprise optionnelle (company, many-to-one vers Company).
La relation employees (one-to-many vers Employee, mappedBy: 'company') est mal nommée :
elle réutilise le mapping inverse de Company::$employees et n'est, en l'état de cette
classe, pas cohérente avec une relation User → Employee propre.
Champs calculés : getActiveSubscription() parcourt subscriptions et retient le plus
récent des abonnements actifs (Subscription::isActive()) par date de début ;
hasActiveSubscription() et getCurrentPlan() en dérivent. hasAccessToPremiumFeatures()
retourne vrai si l'abonnement actif porte un plan nommé Pro ou Entreprise. isManager()
teste la présence du rôle ROLE_MANAGER dans roles.
anonymize() réalise la suppression logique RGPD : horodatage de deletedAt, remplacement
de l'e-mail par une valeur générée, effacement des données personnelles, mot de passe
remplacé par une valeur aléatoire, rôles réduits à ROLE_USER_DELETED.
Groupes de sérialisation exposés à l'API : user:read (email, roles, name, phone_number) et
user:write (email, password, name, phone_number).
Attributes
- #[Entity]
- $repositoryClass: \App\Repository\UserRepository::class
- #[UniqueConstraint]
- $name: 'UNIQ_IDENTIFIER_EMAIL'
- $fields: ['email']
- #[UniqueEntity]
- $fields: ['email']
- $message: 'Un compte existe dejà avec cet email'
Table of Contents
Interfaces
- UserInterface
- PasswordAuthenticatedUserInterface
Properties
- $businessCardAizes : Collection<int, BusinessCardAize>
- $company : Company|null
- $contacts : Collection<int, Contact>
- $country : string|null
- $createdAt : DateTimeImmutable|null
- $deletedAt : DateTimeImmutable|null
- $email : string|null
- $employees : Collection<int, Employee>
- $id : int|null
- $isActivated : bool
- $isVerified : bool
- $mustChangePassword : bool
- $name : string|null
- $orders : Collection<int, Order>
- $password : string
- $PasswordResetToken : string|null
- $payments : Collection<int, Payment>
- $phone_number : string|null
- $position : string|null
- $profil_img : string|null
- $roles : array<int, string>
- $subscriptions : Collection<int, Subscription>
- $updatedAt : DateTimeImmutable|null
- $verificationCode : string|null
- $verificationCodeExpiresAt : DateTimeImmutable|null
- $website : string|null
Methods
- __construct() : mixed
- addBusinessCardAize() : static
- addContact() : static
- addEmployee() : static
- addManagerRole() : static
- Add manager role to user
- addOrder() : static
- addPayment() : static
- addSubscription() : static
- anonymize() : void
- Anonymise les données de l'utilisateur pour une suppression logique
- eraseCredentials() : void
- getActiveSubscription() : Subscription|null
- Récupère l'abonnement actif de l'utilisateur
- getBusinessCardAizes() : Collection<int, BusinessCardAize>
- getCards() : Collection
- Alias pour getBusinessCardAizes() pour compatibilité avec PlanService
- getCompany() : Company|null
- getContacts() : Collection<int, Contact>
- getCountry() : string|null
- getCreatedAt() : DateTimeImmutable|null
- getCurrentPlan() : Plan|null
- Récupère le plan actuel de l'utilisateur
- getDeletedAt() : DateTimeImmutable|null
- getEmail() : string|null
- getEmployees() : Collection<int, Employee>
- getId() : int|null
- getMustChangePassword() : bool
- getName() : string|null
- getOrders() : Collection<int, Order>
- getPassword() : string
- getPasswordResetToken() : string|null
- getPayments() : Collection<int, Payment>
- getPhoneNumber() : string|null
- getPosition() : string|null
- getProfilImg() : string|null
- getRoles() : array<int, string>
- getSubscriptions() : Collection<int, Subscription>
- getUpdatedAt() : DateTimeImmutable|null
- getUserIdentifier() : string
- A visual identifier that represents this user.
- getVerificationCode() : string|null
- getVerificationCodeExpiresAt() : DateTimeImmutable|null
- getWebsite() : string|null
- hasAccessToPremiumFeatures() : bool
- Vérifie si l'utilisateur a accès aux fonctionnalités premium
- hasActiveSubscription() : bool
- Vérifie si l'utilisateur a un abonnement actif
- isActivated() : bool
- isDeleted() : bool
- isManager() : bool
- Check if user has manager role
- isVerificationCodeValid() : bool
- isVerified() : bool
- removeBusinessCardAize() : static
- removeContact() : static
- removeEmployee() : static
- removeManagerRole() : static
- Remove manager role from user
- removeOrder() : static
- removePayment() : static
- removeSubscription() : static
- setActivated() : static
- setCompany() : static
- setCountry() : static
- setCreatedAt() : static
- setDeletedAt() : static
- setEmail() : static
- setMustChangePassword() : static
- setName() : static
- setPassword() : static
- setPasswordResetToken() : static
- setPhoneNumber() : static
- setPosition() : static
- setProfilImg() : static
- setRoles() : static
- setUpdatedAt() : static
- setVerificationCode() : static
- setVerificationCodeExpiresAt() : static
- setVerified() : static
- setWebsite() : static
Properties
$businessCardAizes
private
Collection<int, BusinessCardAize>
$businessCardAizes
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\BusinessCardAize::class
- $mappedBy: 'user'
$company
private
Company|null
$company
= null
Attributes
- #[JoinColumn]
- $nullable: true
- #[ManyToOne]
- $targetEntity: \App\Entity\Company::class
- $inversedBy: 'users'
$contacts
private
Collection<int, Contact>
$contacts
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Contact::class
- $mappedBy: 'user'
- $orphanRemoval: true
$country
private
string|null
$country
= null
Attributes
- #[Column]
- $length: 2
- $nullable: true
$createdAt
private
DateTimeImmutable|null
$createdAt
= null
Attributes
- #[Column]
- $nullable: true
$deletedAt
private
DateTimeImmutable|null
$deletedAt
= null
Attributes
- #[Column]
- $nullable: true
private
string|null
$email
= null
Attributes
- #[Column]
- $length: 180
- #[Groups]
- ['user:read', 'user:write']
$employees
private
Collection<int, Employee>
$employees
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Employee::class
- $mappedBy: 'company'
- $cascade: ['persist', 'remove']
$id
private
int|null
$id
= null
Attributes
- #[Column]
- #[GeneratedValue]
- #[Id]
$isActivated
private
bool
$isActivated
= false
Attributes
- #[Column]
$isVerified
private
bool
$isVerified
= false
Attributes
- #[Column]
$mustChangePassword
private
bool
$mustChangePassword
= false
Attributes
- #[Column]
$name
private
string|null
$name
= null
Attributes
- #[Column]
- $length: 100
- #[Groups]
- ['user:read', 'user:write']
$orders
private
Collection<int, Order>
$orders
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Order::class
- $mappedBy: 'user'
$password
private
string
$password
= null
The hashed password
Attributes
- #[Column]
- #[Groups]
- ['user:write']
$PasswordResetToken
private
string|null
$PasswordResetToken
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
$payments
private
Collection<int, Payment>
$payments
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Payment::class
- $mappedBy: 'user'
$phone_number
private
string|null
$phone_number
= null
Attributes
- #[Column]
- $length: 50
- $nullable: true
- #[Groups]
- ['user:read', 'user:write']
$position
private
string|null
$position
= null
Attributes
- #[Column]
- $length: 100
- $nullable: true
$profil_img
private
string|null
$profil_img
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
$roles
private
array<int, string>
$roles
= []
The user roles
Attributes
- #[Column]
- #[Groups]
- ['user:read']
$subscriptions
private
Collection<int, Subscription>
$subscriptions
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Subscription::class
- $mappedBy: 'user'
$updatedAt
private
DateTimeImmutable|null
$updatedAt
= null
Attributes
- #[Column]
- $nullable: true
$verificationCode
private
string|null
$verificationCode
= null
Attributes
- #[Column]
- $length: 6
- $nullable: true
$verificationCodeExpiresAt
private
DateTimeImmutable|null
$verificationCodeExpiresAt
= null
Attributes
- #[Column]
- $nullable: true
$website
private
string|null
$website
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
Methods
__construct()
public
__construct() : mixed
addBusinessCardAize()
public
addBusinessCardAize(BusinessCardAize $businessCardAize) : static
Parameters
- $businessCardAize : BusinessCardAize
Return values
staticaddContact()
public
addContact(Contact $contact) : static
Parameters
- $contact : Contact
Return values
staticaddEmployee()
public
addEmployee(Employee $employee) : static
Parameters
- $employee : Employee
Return values
staticaddManagerRole()
Add manager role to user
public
addManagerRole() : static
Return values
staticaddOrder()
public
addOrder(Order $order) : static
Parameters
- $order : Order
Return values
staticaddPayment()
public
addPayment(Payment $payment) : static
Parameters
- $payment : Payment
Return values
staticaddSubscription()
public
addSubscription(Subscription $subscription) : static
Parameters
- $subscription : Subscription
Return values
staticanonymize()
Anonymise les données de l'utilisateur pour une suppression logique
public
anonymize() : void
eraseCredentials()
public
eraseCredentials() : void
Tags
getActiveSubscription()
Récupère l'abonnement actif de l'utilisateur
public
getActiveSubscription() : Subscription|null
Return values
Subscription|nullgetBusinessCardAizes()
public
getBusinessCardAizes() : Collection<int, BusinessCardAize>
Return values
Collection<int, BusinessCardAize>getCards()
Alias pour getBusinessCardAizes() pour compatibilité avec PlanService
public
getCards() : Collection
Return values
CollectiongetCompany()
public
getCompany() : Company|null
Return values
Company|nullgetContacts()
public
getContacts() : Collection<int, Contact>
Return values
Collection<int, Contact>getCountry()
public
getCountry() : string|null
Return values
string|nullgetCreatedAt()
public
getCreatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetCurrentPlan()
Récupère le plan actuel de l'utilisateur
public
getCurrentPlan() : Plan|null
Return values
Plan|nullgetDeletedAt()
public
getDeletedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetEmail()
public
getEmail() : string|null
Return values
string|nullgetEmployees()
public
getEmployees() : Collection<int, Employee>
Return values
Collection<int, Employee>getId()
public
getId() : int|null
Return values
int|nullgetMustChangePassword()
public
getMustChangePassword() : bool
Return values
boolgetName()
public
getName() : string|null
Return values
string|nullgetOrders()
public
getOrders() : Collection<int, Order>
Return values
Collection<int, Order>getPassword()
public
getPassword() : string
Tags
Return values
stringgetPasswordResetToken()
public
getPasswordResetToken() : string|null
Return values
string|nullgetPayments()
public
getPayments() : Collection<int, Payment>
Return values
Collection<int, Payment>getPhoneNumber()
public
getPhoneNumber() : string|null
Return values
string|nullgetPosition()
public
getPosition() : string|null
Return values
string|nullgetProfilImg()
public
getProfilImg() : string|null
Return values
string|nullgetRoles()
public
getRoles() : array<int, string>
Tags
Return values
array<int, string>getSubscriptions()
public
getSubscriptions() : Collection<int, Subscription>
Return values
Collection<int, Subscription>getUpdatedAt()
public
getUpdatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetUserIdentifier()
A visual identifier that represents this user.
public
getUserIdentifier() : string
Tags
Return values
stringgetVerificationCode()
public
getVerificationCode() : string|null
Return values
string|nullgetVerificationCodeExpiresAt()
public
getVerificationCodeExpiresAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetWebsite()
public
getWebsite() : string|null
Return values
string|nullhasAccessToPremiumFeatures()
Vérifie si l'utilisateur a accès aux fonctionnalités premium
public
hasAccessToPremiumFeatures() : bool
Return values
boolhasActiveSubscription()
Vérifie si l'utilisateur a un abonnement actif
public
hasActiveSubscription() : bool
Return values
boolisActivated()
public
isActivated() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisManager()
Check if user has manager role
public
isManager() : bool
Return values
boolisVerificationCodeValid()
public
isVerificationCodeValid() : bool
Return values
boolisVerified()
public
isVerified() : bool
Return values
boolremoveBusinessCardAize()
public
removeBusinessCardAize(BusinessCardAize $businessCardAize) : static
Parameters
- $businessCardAize : BusinessCardAize
Return values
staticremoveContact()
public
removeContact(Contact $contact) : static
Parameters
- $contact : Contact
Return values
staticremoveEmployee()
public
removeEmployee(Employee $employee) : static
Parameters
- $employee : Employee
Return values
staticremoveManagerRole()
Remove manager role from user
public
removeManagerRole() : static
Return values
staticremoveOrder()
public
removeOrder(Order $order) : static
Parameters
- $order : Order
Return values
staticremovePayment()
public
removePayment(Payment $payment) : static
Parameters
- $payment : Payment
Return values
staticremoveSubscription()
public
removeSubscription(Subscription $subscription) : static
Parameters
- $subscription : Subscription
Return values
staticsetActivated()
public
setActivated(bool $isActivated) : static
Parameters
- $isActivated : bool
Return values
staticsetCompany()
public
setCompany(Company|null $company) : static
Parameters
- $company : Company|null
Return values
staticsetCountry()
public
setCountry(string|null $country) : static
Parameters
- $country : string|null
Return values
staticsetCreatedAt()
public
setCreatedAt(DateTimeImmutable|null $createdAt) : static
Parameters
- $createdAt : DateTimeImmutable|null
Return values
staticsetDeletedAt()
public
setDeletedAt(DateTimeImmutable|null $deletedAt) : static
Parameters
- $deletedAt : DateTimeImmutable|null
Return values
staticsetEmail()
public
setEmail(string $email) : static
Parameters
- $email : string
Return values
staticsetMustChangePassword()
public
setMustChangePassword(bool $mustChangePassword) : static
Parameters
- $mustChangePassword : bool
Return values
staticsetName()
public
setName(string $name) : static
Parameters
- $name : string
Return values
staticsetPassword()
public
setPassword(string $password) : static
Parameters
- $password : string
Return values
staticsetPasswordResetToken()
public
setPasswordResetToken(string|null $PasswordResetToken) : static
Parameters
- $PasswordResetToken : string|null
Return values
staticsetPhoneNumber()
public
setPhoneNumber(string|null $phone_number) : static
Parameters
- $phone_number : string|null
Return values
staticsetPosition()
public
setPosition(string|null $position) : static
Parameters
- $position : string|null
Return values
staticsetProfilImg()
public
setProfilImg(string|null $profil_img) : static
Parameters
- $profil_img : string|null
Return values
staticsetRoles()
public
setRoles(array<int, string> $roles) : static
Parameters
- $roles : array<int, string>
Return values
staticsetUpdatedAt()
public
setUpdatedAt(DateTimeImmutable|null $updatedAt) : static
Parameters
- $updatedAt : DateTimeImmutable|null
Return values
staticsetVerificationCode()
public
setVerificationCode(string|null $verificationCode) : static
Parameters
- $verificationCode : string|null
Return values
staticsetVerificationCodeExpiresAt()
public
setVerificationCodeExpiresAt(DateTimeImmutable|null $verificationCodeExpiresAt) : static
Parameters
- $verificationCodeExpiresAt : DateTimeImmutable|null
Return values
staticsetVerified()
public
setVerified(bool $isVerified) : static
Parameters
- $isVerified : bool
Return values
staticsetWebsite()
public
setWebsite(string|null $website) : static
Parameters
- $website : string|null