src/Entity/SpecialCustomer.php line 9

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SpecialCustomerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassSpecialCustomerRepository::class)]
  6. class SpecialCustomer
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'specialCustomerPourcent')]
  13.     private $user;
  14.     #[ORM\Column(name'active'type'boolean')]
  15.     private ?bool $active;
  16.     #[ORM\Column(name'pourcentRebate'type'float')]
  17.     private ?float $pourcentRebate;
  18.     #[ORM\Column(name'minQuantity'type'integer'nullabletrue)]
  19.     private ?int $minQuantity null;
  20.     public function getId(): ?int
  21.     {
  22.         return $this->id;
  23.     }
  24.     /**
  25.      * @return mixed
  26.      */
  27.     public function getUser()
  28.     {
  29.         return $this->user;
  30.     }
  31.     /**
  32.      * @param mixed $user
  33.      */
  34.     public function setUser($user): void
  35.     {
  36.         $this->user $user;
  37.     }
  38.     /**
  39.      * @return bool|null
  40.      */
  41.     public function getActive(): ?bool
  42.     {
  43.         return $this->active;
  44.     }
  45.     /**
  46.      * @param bool|null $active
  47.      */
  48.     public function setActive(?bool $active): void
  49.     {
  50.         $this->active $active;
  51.     }
  52.     /**
  53.      * @return float|null
  54.      */
  55.     public function getPourcentRebate(): ?float
  56.     {
  57.         return $this->pourcentRebate;
  58.     }
  59.     /**
  60.      * @param float|null $pourcentRebate
  61.      */
  62.     public function setPourcentRebate(?float $pourcentRebate): void
  63.     {
  64.         $this->pourcentRebate $pourcentRebate;
  65.     }
  66.     /**
  67.      * @return int|null
  68.      */
  69.     public function getMinQuantity(): ?int
  70.     {
  71.         return $this->minQuantity;
  72.     }
  73.     /**
  74.      * @param int|null $minQuantity
  75.      */
  76.     public function setMinQuantity(?int $minQuantity): void
  77.     {
  78.         $this->minQuantity $minQuantity;
  79.     }
  80.     /**
  81.      * Getter virtuel pour le nom de l'entreprise (utilisé par EasyAdmin)
  82.      */
  83.     public function getCompanyName(): ?string
  84.     {
  85.         if (!$this->user) {
  86.             return null;
  87.         }
  88.         return $this->user->getCompanyNameFromAdditionalInfo() ?? $this->user->getCompanyName();
  89.     }
  90.     /**
  91.      * Getter virtuel pour l'email de l'utilisateur (utilisé par EasyAdmin)
  92.      */
  93.     public function getUserEmail(): ?string
  94.     {
  95.         return $this->user $this->user->getEmail() : null;
  96.     }
  97. }