src/Entity/ClientType.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity()
  6.  * @ORM\Table(
  7.  *     name="client_type",
  8.  *     uniqueConstraints={
  9.  *         @ORM\UniqueConstraint(name="UNIQ_CLIENT_TYPE_CODE", columns={"code"})
  10.  *     },
  11.  *     indexes={
  12.  *         @ORM\Index(name="IDX_CLIENT_TYPE_ACTIVE", columns={"is_active"}),
  13.  *         @ORM\Index(name="IDX_CLIENT_TYPE_PRIORITY", columns={"priority"})
  14.  *     }
  15.  * )
  16.  */
  17. class ClientType
  18. {
  19.     //public const TYPE_NOUVEAU_CLIENT = 'NEW';
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private ?int $id null;
  26.     /**
  27.      * @ORM\Column(type="string", length=50, unique=true)
  28.      */
  29.     private string $code;
  30.     /**
  31.      * @ORM\Column(type="string", length=150)
  32.      */
  33.     private string $label;
  34.     /**
  35.      * @ORM\Column(type="string", length=30)
  36.      */
  37.     private string $color;
  38.     /**
  39.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  40.      */
  41.     private ?string $minTotalAmount null;
  42.     /**
  43.      * @ORM\Column(type="integer", nullable=true)
  44.      */
  45.     private ?int $minValidOrdersCount  null;
  46.     /**
  47.      * @ORM\Column(type="integer", nullable=true)
  48.      */
  49.     private $minTotalOrdersCount;
  50.    
  51.     /**
  52.      * @ORM\Column(type="integer", nullable=true)
  53.      */
  54.     private ?int $inactivityMonths null;
  55.     /**
  56.      * @ORM\Column(type="integer")
  57.      */
  58.     private int $priority 0;
  59.     /**
  60.      * @ORM\Column(name="is_active", type="boolean")
  61.      */
  62.     private bool $isActive true;
  63.     /**
  64.      * @ORM\Column(type="text", nullable=true)
  65.      */
  66.     private ?string $description null;
  67.     /**
  68.      * @ORM\Column(type="string", length=3, options={"default": "and"})
  69.      */
  70.     private $operator 'and'// Valeur par défaut : AND
  71.    
  72.     /**
  73.      * @ORM\Column(type="float", nullable=true)
  74.      */
  75.     private $minCancelRate;
  76.     /**
  77.      * @ORM\Column(type="float", nullable=true)
  78.      */
  79.     private $maxCancelRate;
  80.     /**
  81.      * @ORM\Column(type="float", nullable=true)
  82.      */
  83.     private $minReturnRate;
  84.     /**
  85.      * @ORM\Column(type="float", nullable=true)
  86.      */
  87.     private $maxReturnRate;
  88.    
  89.     /* ==========================================================
  90.        Magic
  91.        ========================================================== */
  92.     public function __toString(): string
  93.     {
  94.         return $this->label;
  95.     }
  96.     /* ==========================================================
  97.        Getters / Setters
  98.        ========================================================== */
  99.     public function getId(): ?int
  100.     {
  101.         return $this->id;
  102.     }
  103.     public function getCode(): string
  104.     {
  105.         return $this->code;
  106.     }
  107.     public function setCode(string $code): self
  108.     {
  109.         $this->code strtoupper(trim($code));
  110.         return $this;
  111.     }
  112.     public function getLabel(): string
  113.     {
  114.         return $this->label;
  115.     }
  116.     public function setLabel(string $label): self
  117.     {
  118.         $this->label trim($label);
  119.         return $this;
  120.     }
  121.     public function getColor(): string
  122.     {
  123.         return $this->color;
  124.     }
  125.     public function setColor(string $color): self
  126.     {
  127.         $this->color strtolower($color);
  128.         return $this;
  129.     }
  130.     public function getMinTotalAmount(): ?string
  131.     {
  132.         return $this->minTotalAmount;
  133.     }
  134.     public function setMinTotalAmount(?string $amount): self
  135.     {
  136.         $this->minTotalAmount $amount;
  137.         return $this;
  138.     }
  139.     public function getminValidOrdersCount (): ?int
  140.     {
  141.         return $this->minValidOrdersCount ;
  142.     }
  143.     public function setminValidOrdersCount (?int $count): self
  144.     {
  145.         $this->minValidOrdersCount  $count;
  146.         return $this;
  147.     }
  148.      public function getMinTotalOrdersCount(): ?int
  149.     {
  150.         return $this->minTotalOrdersCount;
  151.     }
  152.     public function setMinTotalOrdersCount(?int $count): self
  153.     {
  154.         $this->minTotalOrdersCount $count;
  155.         return $this;
  156.     }
  157.     
  158.     public function getInactivityMonths(): ?int
  159.     {
  160.         return $this->inactivityMonths;
  161.     }
  162.     public function setInactivityMonths(?int $months): self
  163.     {
  164.         $this->inactivityMonths $months;
  165.         return $this;
  166.     }
  167.     public function getPriority(): int
  168.     {
  169.         return $this->priority;
  170.     }
  171.     public function setPriority(int $priority): self
  172.     {
  173.         $this->priority $priority;
  174.         return $this;
  175.     }
  176.     /**
  177.      * Getter booléen CORRECT
  178.      */
  179.     public function isActive(): bool
  180.     {
  181.         return $this->isActive;
  182.     }
  183.     public function setIsActive(bool $active): self
  184.     {
  185.         $this->isActive $active;
  186.         return $this;
  187.     }
  188.     public function getDescription(): ?string
  189.     {
  190.         return $this->description;
  191.     }
  192.     public function setDescription(?string $description): self
  193.     {
  194.         $this->description $description;
  195.         return $this;
  196.     }
  197.      public function getOperator(): ?string
  198.     {
  199.         return $this->operator;
  200.     }
  201.     public function setOperator(string $operator): self
  202.     {
  203.         $this->operator $operator;
  204.         return $this;
  205.     }
  206.     public function getMinCancelRate(): ?float { return $this->minCancelRate; }
  207.     public function setMinCancelRate(?float $minCancelRate): self $this->minCancelRate $minCancelRate; return $this; }
  208.     public function getMaxCancelRate(): ?float { return $this->maxCancelRate; }
  209.     public function setMaxCancelRate(?float $maxCancelRate): self $this->maxCancelRate $maxCancelRate; return $this; }
  210.     public function getMinReturnRate(): ?float { return $this->minReturnRate; }
  211.     public function setMinReturnRate(?float $minReturnRate): self $this->minReturnRate $minReturnRate; return $this; }
  212.     public function getMaxReturnRate(): ?float { return $this->maxReturnRate; }
  213.     public function setMaxReturnRate(?float $maxReturnRate): self $this->maxReturnRate $maxReturnRate; return $this; }
  214. }