Company
in package
Entreprise cliente, porteuse de ses utilisateurs, employés, abonnements et paiements.
Relations : plusieurs User (users, one-to-many), plusieurs Employee (employees,
one-to-many avec suppression en cascade), plusieurs Subscription (subscriptions,
one-to-many avec suppression en cascade), plusieurs Payment (payments, one-to-many) et
plusieurs CompanyActivity (companyActivities, one-to-many avec suppression en cascade).
getManager() retourne le premier utilisateur de users portant le rôle ROLE_MANAGER
(aucune relation dédiée : simple parcours de la collection). getCurrentSubscription()
retourne le premier abonnement de subscriptions dont isActive() est vrai.
Chaque setter (hormis setCreatedAt()) met à jour updatedAt à l'horodatage courant ; ce
champ n'est donc jamais synchronisé automatiquement par Doctrine, uniquement par la classe
elle-même.
getActivities() / setActivities() sont conservées @deprecated pour compatibilité :
getActivities() dérive un tableau de libellés depuis companyActivities, et
setActivities() ne fait plus rien d'autre que rafraîchir updatedAt.
Attributes
- #[Entity]
- #[Table]
- $name: 'company'
Table of Contents
Properties
- $address : string|null
- $city : string|null
- $companyActivities : Collection<int, CompanyActivity>
- $country : string|null
- $createdAt : DateTimeImmutable|null
- $description : string|null
- $email : string|null
- $employeeCount : int|null
- $employees : Collection<int, Employee>
- $id : int|null
- $isActive : bool
- $logoPath : string|null
- $name : string|null
- $payments : Collection<int, Payment>
- $phone : string|null
- $primaryColor : string|null
- $secondaryColor : string|null
- $subscriptions : Collection<int, Subscription>
- $updatedAt : DateTimeImmutable|null
- $users : Collection<int, User>
- $website : string|null
Methods
- __construct() : mixed
- addCompanyActivity() : static
- addEmployee() : static
- addPayment() : static
- addSubscription() : static
- addUser() : static
- getActivities() : array<string|int, mixed>|null
- Méthode de compatibilité pour l'ancien système
- getAddress() : string|null
- getCity() : string|null
- getCompanyActivities() : Collection<int, CompanyActivity>
- getCountry() : string|null
- getCreatedAt() : DateTimeImmutable|null
- getCurrentSubscription() : Subscription|null
- Get the current active subscription
- getDescription() : string|null
- getEmail() : string|null
- getEmployeeCount() : int|null
- getEmployees() : Collection<int, Employee>
- getId() : int|null
- getLogoPath() : string|null
- getManager() : User|null
- Get the manager (first user with ROLE_MANAGER) of this company
- getName() : string|null
- getPayments() : Collection<int, Payment>
- getPhone() : string|null
- getPrimaryColor() : string|null
- getSecondaryColor() : string|null
- getSubscriptions() : Collection<int, Subscription>
- getUpdatedAt() : DateTimeImmutable|null
- getUsers() : Collection<int, User>
- getWebsite() : string|null
- isActive() : bool
- removeCompanyActivity() : static
- removeEmployee() : static
- removePayment() : static
- removeSubscription() : static
- removeUser() : static
- setActivities() : static
- Méthode de compatibilité pour l'ancien système
- setAddress() : static
- setCity() : static
- setCountry() : static
- setCreatedAt() : static
- setDescription() : static
- setEmail() : static
- setEmployeeCount() : static
- setIsActive() : static
- setLogoPath() : static
- setName() : static
- setPhone() : static
- setPrimaryColor() : static
- setSecondaryColor() : static
- setUpdatedAt() : static
- setWebsite() : static
Properties
$address
private
string|null
$address
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
- #[NotBlank]
- $message: 'L\'adresse est obligatoire'
$city
private
string|null
$city
= null
Attributes
- #[Column]
- $length: 100
- $nullable: true
- #[NotBlank]
- $message: 'La ville est obligatoire'
$companyActivities
private
Collection<int, CompanyActivity>
$companyActivities
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\CompanyActivity::class
- $mappedBy: 'company'
- $cascade: ['persist', 'remove']
$country
private
string|null
$country
= null
Attributes
- #[Column]
- $length: 100
- $nullable: true
- #[NotBlank]
- $message: 'Le pays est obligatoire'
$createdAt
private
DateTimeImmutable|null
$createdAt
= null
Attributes
- #[Column]
$description
private
string|null
$description
= null
Attributes
- #[Column]
- $type: 'text'
- $nullable: true
private
string|null
$email
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
- #[Email]
- $message: 'Veuillez saisir un email valide'
$employeeCount
private
int|null
$employeeCount
= null
Attributes
- #[Column]
- #[NotBlank]
- $message: 'Le nombre d\'employés est obligatoire'
- #[Positive]
- $message: 'Le nombre d\'employés doit être positif'
$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]
$isActive
private
bool
$isActive
= true
Attributes
- #[Column]
$logoPath
private
string|null
$logoPath
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
$name
private
string|null
$name
= null
Attributes
- #[Column]
- $length: 255
- #[Length]
- $min: 2
- $max: 255
- $minMessage: 'Le nom doit contenir au moins 2 caractères'
- #[NotBlank]
- $message: 'Le nom de l\'entreprise est obligatoire'
$payments
private
Collection<int, Payment>
$payments
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Payment::class
- $mappedBy: 'company'
$phone
private
string|null
$phone
= null
Attributes
- #[Column]
- $length: 20
- $nullable: true
- #[Regex]
- $pattern: '/^[+]?[0-9\s\-\(\)]+$/'
- $message: 'Numéro de téléphone invalide'
$primaryColor
private
string|null
$primaryColor
= null
Attributes
- #[Column]
- $length: 7
- $nullable: true
- #[Regex]
- $pattern: '/^#[0-9A-Fa-f]{6}$/'
- $message: 'La couleur principale doit être au format hexadécimal (#RRGGBB)'
$secondaryColor
private
string|null
$secondaryColor
= null
Attributes
- #[Column]
- $length: 7
- $nullable: true
- #[Regex]
- $pattern: '/^#[0-9A-Fa-f]{6}$/'
- $message: 'La couleur secondaire doit être au format hexadécimal (#RRGGBB)'
$subscriptions
private
Collection<int, Subscription>
$subscriptions
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\Subscription::class
- $mappedBy: 'company'
- $cascade: ['persist', 'remove']
$updatedAt
private
DateTimeImmutable|null
$updatedAt
= null
Attributes
- #[Column]
$users
private
Collection<int, User>
$users
Attributes
- #[OneToMany]
- $targetEntity: \App\Entity\User::class
- $mappedBy: 'company'
$website
private
string|null
$website
= null
Attributes
- #[Column]
- $length: 255
- $nullable: true
- #[Url]
- $message: 'Veuillez entrer une URL valide'
Methods
__construct()
public
__construct() : mixed
addCompanyActivity()
public
addCompanyActivity(CompanyActivity $companyActivity) : static
Parameters
- $companyActivity : CompanyActivity
Return values
staticaddEmployee()
public
addEmployee(Employee $employee) : static
Parameters
- $employee : Employee
Return values
staticaddPayment()
public
addPayment(Payment $payment) : static
Parameters
- $payment : Payment
Return values
staticaddSubscription()
public
addSubscription(Subscription $subscription) : static
Parameters
- $subscription : Subscription
Return values
staticaddUser()
public
addUser(User $user) : static
Parameters
- $user : User
Return values
staticgetActivities()
Méthode de compatibilité pour l'ancien système
public
getActivities() : array<string|int, mixed>|null
Utiliser getCompanyActivities() à la place
Return values
array<string|int, mixed>|nullgetAddress()
public
getAddress() : string|null
Return values
string|nullgetCity()
public
getCity() : string|null
Return values
string|nullgetCompanyActivities()
public
getCompanyActivities() : Collection<int, CompanyActivity>
Return values
Collection<int, CompanyActivity>getCountry()
public
getCountry() : string|null
Return values
string|nullgetCreatedAt()
public
getCreatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetCurrentSubscription()
Get the current active subscription
public
getCurrentSubscription() : Subscription|null
Return values
Subscription|nullgetDescription()
public
getDescription() : string|null
Return values
string|nullgetEmail()
public
getEmail() : string|null
Return values
string|nullgetEmployeeCount()
public
getEmployeeCount() : int|null
Return values
int|nullgetEmployees()
public
getEmployees() : Collection<int, Employee>
Return values
Collection<int, Employee>getId()
public
getId() : int|null
Return values
int|nullgetLogoPath()
public
getLogoPath() : string|null
Return values
string|nullgetManager()
Get the manager (first user with ROLE_MANAGER) of this company
public
getManager() : User|null
Return values
User|nullgetName()
public
getName() : string|null
Return values
string|nullgetPayments()
public
getPayments() : Collection<int, Payment>
Return values
Collection<int, Payment>getPhone()
public
getPhone() : string|null
Return values
string|nullgetPrimaryColor()
public
getPrimaryColor() : string|null
Return values
string|nullgetSecondaryColor()
public
getSecondaryColor() : string|null
Return values
string|nullgetSubscriptions()
public
getSubscriptions() : Collection<int, Subscription>
Return values
Collection<int, Subscription>getUpdatedAt()
public
getUpdatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetUsers()
public
getUsers() : Collection<int, User>
Return values
Collection<int, User>getWebsite()
public
getWebsite() : string|null
Return values
string|nullisActive()
public
isActive() : bool
Return values
boolremoveCompanyActivity()
public
removeCompanyActivity(CompanyActivity $companyActivity) : static
Parameters
- $companyActivity : CompanyActivity
Return values
staticremoveEmployee()
public
removeEmployee(Employee $employee) : static
Parameters
- $employee : Employee
Return values
staticremovePayment()
public
removePayment(Payment $payment) : static
Parameters
- $payment : Payment
Return values
staticremoveSubscription()
public
removeSubscription(Subscription $subscription) : static
Parameters
- $subscription : Subscription
Return values
staticremoveUser()
public
removeUser(User $user) : static
Parameters
- $user : User
Return values
staticsetActivities()
Méthode de compatibilité pour l'ancien système
public
setActivities(array<string|int, mixed>|null $activities) : static
Utiliser addCompanyActivity() à la place
Parameters
- $activities : array<string|int, mixed>|null
Return values
staticsetAddress()
public
setAddress(string|null $address) : static
Parameters
- $address : string|null
Return values
staticsetCity()
public
setCity(string|null $city) : static
Parameters
- $city : string|null
Return values
staticsetCountry()
public
setCountry(string|null $country) : static
Parameters
- $country : string|null
Return values
staticsetCreatedAt()
public
setCreatedAt(DateTimeImmutable $createdAt) : static
Parameters
- $createdAt : DateTimeImmutable
Return values
staticsetDescription()
public
setDescription(string|null $description) : static
Parameters
- $description : string|null
Return values
staticsetEmail()
public
setEmail(string|null $email) : static
Parameters
- $email : string|null
Return values
staticsetEmployeeCount()
public
setEmployeeCount(int $employeeCount) : static
Parameters
- $employeeCount : int
Return values
staticsetIsActive()
public
setIsActive(bool $isActive) : static
Parameters
- $isActive : bool
Return values
staticsetLogoPath()
public
setLogoPath(string|null $logoPath) : static
Parameters
- $logoPath : string|null
Return values
staticsetName()
public
setName(string $name) : static
Parameters
- $name : string
Return values
staticsetPhone()
public
setPhone(string|null $phone) : static
Parameters
- $phone : string|null
Return values
staticsetPrimaryColor()
public
setPrimaryColor(string|null $primaryColor) : static
Parameters
- $primaryColor : string|null
Return values
staticsetSecondaryColor()
public
setSecondaryColor(string|null $secondaryColor) : static
Parameters
- $secondaryColor : string|null
Return values
staticsetUpdatedAt()
public
setUpdatedAt(DateTimeImmutable $updatedAt) : static
Parameters
- $updatedAt : DateTimeImmutable
Return values
staticsetWebsite()
public
setWebsite(string|null $website) : static
Parameters
- $website : string|null