src/Entity/SuiviConsoActivation.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SuiviConsoActivationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass=SuiviConsoActivationRepository::class)
  8.  *
  9.  */
  10. class SuiviConsoActivation implements PostAwareInterface
  11. {
  12.     const UNITIES = [
  13.         'm<sup>3</sup>' => 'm3',
  14.         'L' => 'L'
  15.     ];
  16.     const PERIODICITIES = [
  17.         'Par heure' => 'hour',
  18.         'Par jour' => 'day',
  19.         'Par semaine' => 'week',
  20.         'Par mois' => 'month'
  21.     ];
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="suiviConsoActivations")
  30.      * @ORM\JoinColumn(nullable=false)
  31.      */
  32.     private $customer;
  33.     /**
  34.      * @ORM\Column(type="string", length=50, nullable=true)
  35.      */
  36.     private $contractNumber;
  37.     /**
  38.      * @ORM\Column(type="string", length=50, nullable=true)
  39.      */
  40.     private $postNumber;
  41.     /**
  42.      * @ORM\Column(type="boolean")
  43.      */
  44.     private $activated;
  45.     /**
  46.      * @ORM\Column(type="boolean", nullable=true)
  47.      * @Assert\Expression(
  48.      *     "value == false or this.getActivated() == true",
  49.      *     message="Cannot activate the alert if the detail is not activated"
  50.      * )
  51.      */
  52.     private $alertToggle;
  53.     /**
  54.      * @ORM\Column(type="string", length=2, nullable=true)
  55.      * @Assert\Choice (choices=SuiviConsoActivation::UNITIES, message="Choose a valid unity")
  56.      */
  57.     private $preferedUnity;
  58.     /**
  59.      * @ORM\Column(type="float", nullable=true)
  60.      */
  61.     private $threshold;
  62.     /**
  63.      * @ORM\Column(type="string", length=5, nullable=true)
  64.      * @Assert\Choice (choices=SuiviConsoActivation::PERIODICITIES, message="Choose a valid periodicity")
  65.      */
  66.     private $periodicity;
  67.     /**
  68.      * @ORM\Column(type="datetime", nullable=true)
  69.      */
  70.     private $activationDate;
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getCustomer(): ?User
  76.     {
  77.         return $this->customer;
  78.     }
  79.     public function setCustomer(?User $customer): self
  80.     {
  81.         $this->customer $customer;
  82.         return $this;
  83.     }
  84.     public function getContractNumber(): ?string
  85.     {
  86.         return $this->contractNumber;
  87.     }
  88.     public function setContractNumber(?string $contractNumber): self
  89.     {
  90.         $this->contractNumber $contractNumber;
  91.         return $this;
  92.     }
  93.     public function getPostNumber(): ?string
  94.     {
  95.         return $this->postNumber;
  96.     }
  97.     public function setPostNumber(?string $postNumber): self
  98.     {
  99.         $this->postNumber $postNumber;
  100.         return $this;
  101.     }
  102.     public function getActivated(): ?bool
  103.     {
  104.         return $this->activated;
  105.     }
  106.     public function setActivated(bool $activated): self
  107.     {
  108.         $this->activated $activated;
  109.         return $this;
  110.     }
  111.     public function getAlertToggle(): ?bool
  112.     {
  113.         return $this->alertToggle;
  114.     }
  115.     public function setAlertToggle(?bool $alertToggle): self
  116.     {
  117.         $this->alertToggle $alertToggle;
  118.         return $this;
  119.     }
  120.     public function getPreferedUnity(): ?string
  121.     {
  122.         return $this->preferedUnity;
  123.     }
  124.     public function setPreferedUnity(?string $preferedUnity): self
  125.     {
  126.         $this->preferedUnity $preferedUnity;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return null|float Alert activation threshold, in m3
  131.      */
  132.     public function getThreshold(): ?float
  133.     {
  134.         return $this->threshold;
  135.     }
  136.     public function setThreshold(?float $threshold): self
  137.     {
  138.         $this->threshold $threshold;
  139.         return $this;
  140.     }
  141.     public function getPeriodicity(): ?string
  142.     {
  143.         return $this->periodicity;
  144.     }
  145.     public function setPeriodicity(?string $periodicity): self
  146.     {
  147.         $this->periodicity $periodicity;
  148.         return $this;
  149.     }
  150.     public function getActivationDate(): ?\DateTime
  151.     {
  152.         return $this->activationDate;
  153.     }
  154.     public function setActivationDate (?\DateTime $activationDate): self
  155.     {
  156.         $this->activationDate $activationDate;
  157.         return $this;
  158.     }
  159. }