BCard - Documentation technique

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

$email

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

addContact()

public addContact(Contact $contact) : static
Parameters
$contact : Contact
Return values
static

addEmployee()

public addEmployee(Employee $employee) : static
Parameters
$employee : Employee
Return values
static

addManagerRole()

Add manager role to user

public addManagerRole() : static
Return values
static

addOrder()

public addOrder(Order $order) : static
Parameters
$order : Order
Return values
static

addPayment()

public addPayment(Payment $payment) : static
Parameters
$payment : Payment
Return values
static

anonymize()

Anonymise les données de l'utilisateur pour une suppression logique

public anonymize() : void

eraseCredentials()

public eraseCredentials() : void
Tags
see
UserInterface

getActiveSubscription()

Récupère l'abonnement actif de l'utilisateur

public getActiveSubscription() : Subscription|null
Return values
Subscription|null

getCards()

Alias pour getBusinessCardAizes() pour compatibilité avec PlanService

public getCards() : Collection
Return values
Collection

getContacts()

public getContacts() : Collection<int, Contact>
Return values
Collection<int, Contact>

getCountry()

public getCountry() : string|null
Return values
string|null

getCreatedAt()

public getCreatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getCurrentPlan()

Récupère le plan actuel de l'utilisateur

public getCurrentPlan() : Plan|null
Return values
Plan|null

getDeletedAt()

public getDeletedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getEmail()

public getEmail() : string|null
Return values
string|null

getEmployees()

public getEmployees() : Collection<int, Employee>
Return values
Collection<int, Employee>

getId()

public getId() : int|null
Return values
int|null

getMustChangePassword()

public getMustChangePassword() : bool
Return values
bool

getName()

public getName() : string|null
Return values
string|null

getOrders()

public getOrders() : Collection<int, Order>
Return values
Collection<int, Order>

getPassword()

public getPassword() : string
Tags
see
PasswordAuthenticatedUserInterface
Return values
string

getPasswordResetToken()

public getPasswordResetToken() : string|null
Return values
string|null

getPayments()

public getPayments() : Collection<int, Payment>
Return values
Collection<int, Payment>

getPhoneNumber()

public getPhoneNumber() : string|null
Return values
string|null

getPosition()

public getPosition() : string|null
Return values
string|null

getProfilImg()

public getProfilImg() : string|null
Return values
string|null

getRoles()

public getRoles() : array<int, string>
Tags
see
UserInterface
Return values
array<int, string>

getUpdatedAt()

public getUpdatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getUserIdentifier()

A visual identifier that represents this user.

public getUserIdentifier() : string
Tags
see
UserInterface
Return values
string

getVerificationCode()

public getVerificationCode() : string|null
Return values
string|null

getVerificationCodeExpiresAt()

public getVerificationCodeExpiresAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getWebsite()

public getWebsite() : string|null
Return values
string|null

hasAccessToPremiumFeatures()

Vérifie si l'utilisateur a accès aux fonctionnalités premium

public hasAccessToPremiumFeatures() : bool
Return values
bool

hasActiveSubscription()

Vérifie si l'utilisateur a un abonnement actif

public hasActiveSubscription() : bool
Return values
bool

isActivated()

public isActivated() : bool
Return values
bool

isDeleted()

public isDeleted() : bool
Return values
bool

isManager()

Check if user has manager role

public isManager() : bool
Return values
bool

isVerificationCodeValid()

public isVerificationCodeValid() : bool
Return values
bool

isVerified()

public isVerified() : bool
Return values
bool

removeContact()

public removeContact(Contact $contact) : static
Parameters
$contact : Contact
Return values
static

removeEmployee()

public removeEmployee(Employee $employee) : static
Parameters
$employee : Employee
Return values
static

removeManagerRole()

Remove manager role from user

public removeManagerRole() : static
Return values
static

removeOrder()

public removeOrder(Order $order) : static
Parameters
$order : Order
Return values
static

removePayment()

public removePayment(Payment $payment) : static
Parameters
$payment : Payment
Return values
static

removeSubscription()

public removeSubscription(Subscription $subscription) : static
Parameters
$subscription : Subscription
Return values
static

setActivated()

public setActivated(bool $isActivated) : static
Parameters
$isActivated : bool
Return values
static

setCompany()

public setCompany(Company|null $company) : static
Parameters
$company : Company|null
Return values
static

setCountry()

public setCountry(string|null $country) : static
Parameters
$country : string|null
Return values
static

setCreatedAt()

public setCreatedAt(DateTimeImmutable|null $createdAt) : static
Parameters
$createdAt : DateTimeImmutable|null
Return values
static

setDeletedAt()

public setDeletedAt(DateTimeImmutable|null $deletedAt) : static
Parameters
$deletedAt : DateTimeImmutable|null
Return values
static

setEmail()

public setEmail(string $email) : static
Parameters
$email : string
Return values
static

setMustChangePassword()

public setMustChangePassword(bool $mustChangePassword) : static
Parameters
$mustChangePassword : bool
Return values
static

setName()

public setName(string $name) : static
Parameters
$name : string
Return values
static

setPassword()

public setPassword(string $password) : static
Parameters
$password : string
Return values
static

setPasswordResetToken()

public setPasswordResetToken(string|null $PasswordResetToken) : static
Parameters
$PasswordResetToken : string|null
Return values
static

setPhoneNumber()

public setPhoneNumber(string|null $phone_number) : static
Parameters
$phone_number : string|null
Return values
static

setPosition()

public setPosition(string|null $position) : static
Parameters
$position : string|null
Return values
static

setProfilImg()

public setProfilImg(string|null $profil_img) : static
Parameters
$profil_img : string|null
Return values
static

setRoles()

public setRoles(array<int, string> $roles) : static
Parameters
$roles : array<int, string>
Return values
static

setUpdatedAt()

public setUpdatedAt(DateTimeImmutable|null $updatedAt) : static
Parameters
$updatedAt : DateTimeImmutable|null
Return values
static

setVerificationCode()

public setVerificationCode(string|null $verificationCode) : static
Parameters
$verificationCode : string|null
Return values
static

setVerificationCodeExpiresAt()

public setVerificationCodeExpiresAt(DateTimeImmutable|null $verificationCodeExpiresAt) : static
Parameters
$verificationCodeExpiresAt : DateTimeImmutable|null
Return values
static

setVerified()

public setVerified(bool $isVerified) : static
Parameters
$isVerified : bool
Return values
static

setWebsite()

public setWebsite(string|null $website) : static
Parameters
$website : string|null
Return values
static

        
On this page

Search results