src/Entity/OrlOffice.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrlOfficeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=OrlOfficeRepository::class)
  11.  */
  12. class OrlOffice
  13. {
  14.     const STATE_NEW='new';
  15.     const STATE_VALID='valid';
  16.     const STATE_REJECTED='rejected';
  17.     const STATE_TOBEDELETED='to_be_deleted';
  18.     const AREA_SEARCH 20// perimetre de recherche des stores par défaut (reach)
  19.     const AREA_SEARCH_EXT 100// perimetre de recherche étendu si aucun store (reach extends)
  20.     const NUM_PER_PAGE 10// nombre de store par page (finder)
  21.     const NUM_TOP_CLIENT 3// nombre de store dans la selection MCA (top page)
  22.     /**
  23.      * @ORM\Id()
  24.      * @ORM\GeneratedValue()
  25.      * @ORM\Column(type="integer")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      * @var string
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      * @var string
  36.      */
  37.     private $address;
  38.     /**
  39.      * @ORM\Column(type="string", length=5)
  40.      * @Assert\Regex(
  41.      *     pattern="/^(([0-8][0-9])|(9[0-5])|(2[ab]))[0-9]{3}$/",
  42.      *     message="Le code postal n'est pas valide"
  43.      * )
  44.      * @var string
  45.      */
  46.     private $zipCode;
  47.     /**
  48.      * @ORM\Column(type="string", length=255)
  49.      * @var string
  50.      */
  51.     private $city;
  52.     /**
  53.      * @Assert\Regex(pattern="/^(?:\+33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/", message="Le numéro de téléphone n'est pas valide.")
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      * @var string
  56.      */
  57.     private $phoneNumber;
  58.     /**
  59.      * @ORM\Column(type="float", nullable=true)
  60.      * @var float
  61.      */
  62.     private $latitude;
  63.     /**
  64.      * @ORM\Column(type="float", nullable=true)
  65.      * @var float
  66.      */
  67.     private $longitude;
  68.     /**
  69.      * @ORM\Column(type="string", length=25)
  70.      */
  71.     private $state=self::STATE_NEW;
  72.     /**
  73.      * @ORM\Column(type="boolean", options={"default" : true})
  74.      * @var bool
  75.      */
  76.     private $acquisitionEnabled true;
  77.     /**
  78.      * @ORM\Column(type="float", nullable=true)
  79.      * @var float
  80.      */
  81.     private $reach;
  82.     /**
  83.      * @ORM\Column(type="boolean", options={"default" : false})
  84.      * @var bool
  85.      */
  86.     private $isPriority false;
  87.     /**
  88.      * @ORM\Column(type="string", length=25, nullable=true)
  89.      * @var string
  90.      */
  91.     private $siretNumber;
  92.     /**
  93.      * @var \DateTime $updated
  94.      *
  95.      * @Gedmo\Timestampable(on="update")
  96.      * @ORM\Column(type="datetime")
  97.      */
  98.     private $updatedAt;
  99.     /**
  100.      * @var \DateTime
  101.      * @ORM\Column(type="datetime", nullable=true)
  102.      */
  103.     private $deletedAt;
  104.     /**
  105.      * @ORM\OneToMany(targetEntity="App\Entity\OrlProspectOnOrlOffice", mappedBy="orlOffice")
  106.      */
  107.     private $orlProspectsOnOrlOffice;
  108.     public function __construct()
  109.     {
  110.         $this->orlProspectsOnOrlOffice = new ArrayCollection();
  111.     }
  112.     public function getId(): ?int
  113.     {
  114.         return $this->id;
  115.     }
  116.     public function getName(): ?string
  117.     {
  118.         if(! is_null($this->deletedAt)){
  119.             return $this->name.' (supprimé)';
  120.         }
  121.         return $this->name;
  122.     }
  123.     public function setName(string $name): self
  124.     {
  125.         $this->name $name;
  126.         return $this;
  127.     }
  128.     public function getState(): ?string
  129.     {
  130.         return $this->state;
  131.     }
  132.     public function setState(string $state): self
  133.     {
  134.         $this->state $state;
  135.         return $this;
  136.     }
  137.     /**
  138.      * Obtenir l'adresse complète
  139.      * @return string
  140.      */
  141.     public function getFullAddress() {
  142.         return $this->getAddress() . ' ' $this->getZipCode() . ' ' $this->getCity();
  143.     }
  144.     public function getAddress(): ?string
  145.     {
  146.         return $this->address;
  147.     }
  148.     public function setAddress(?string $address): self
  149.     {
  150.         $this->address $address;
  151.         return $this;
  152.     }
  153.     public function getZipCode(): ?string
  154.     {
  155.         return $this->zipCode;
  156.     }
  157.     public function setZipCode(string $zipCode): self
  158.     {
  159.         $this->zipCode $zipCode;
  160.         return $this;
  161.     }
  162.     public function getCity(): ?string
  163.     {
  164.         return $this->city;
  165.     }
  166.     public function setCity(string $city): self
  167.     {
  168.         $this->city $city;
  169.         return $this;
  170.     }
  171.     public function getPhoneNumber(): ?string
  172.     {
  173.         return $this->phoneNumber;
  174.     }
  175.     public function setPhoneNumber(?string $phoneNumber): self
  176.     {
  177.         $this->phoneNumber $phoneNumber;
  178.         return $this;
  179.     }
  180.     public function getLatitude(): ?float
  181.     {
  182.         return $this->latitude;
  183.     }
  184.     public function setLatitude(?float $latitude): self
  185.     {
  186.         $this->latitude $latitude;
  187.         return $this;
  188.     }
  189.     public function getLongitude(): ?float
  190.     {
  191.         return $this->longitude;
  192.     }
  193.     public function setLongitude(?float $longitude): self
  194.     {
  195.         $this->longitude $longitude;
  196.         return $this;
  197.     }
  198.     public function getAcquisitionEnabled(): ?bool
  199.     {
  200.         return $this->acquisitionEnabled;
  201.     }
  202.     public function setAcquisitionEnabled(bool $acquisitionEnabled): self
  203.     {
  204.         $this->acquisitionEnabled $acquisitionEnabled;
  205.         return $this;
  206.     }
  207.     public function getReach(): ?float
  208.     {
  209.         return $this->reach;
  210.     }
  211.     public function setReach(?float $reach): self
  212.     {
  213.         $this->reach $reach;
  214.         return $this;
  215.     }
  216.     public function getIsPriority(): ?bool
  217.     {
  218.         return $this->isPriority;
  219.     }
  220.     public function setIsPriority(bool $isPriority): self
  221.     {
  222.         $this->isPriority $isPriority;
  223.         return $this;
  224.     }
  225.     public function getSiretNumber(): ?string
  226.     {
  227.         return $this->siretNumber;
  228.     }
  229.     public function setSiretNumber(?string $siretNumber): self
  230.     {
  231.         $siretNumber str_replace(' '''$siretNumber);
  232.         $this->siretNumber $siretNumber;
  233.         return $this;
  234.     }
  235.     public function getUpdatedAt(): ?\DateTimeInterface
  236.     {
  237.         return $this->updatedAt;
  238.     }
  239.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  240.     {
  241.         $this->updatedAt $updatedAt;
  242.         return $this;
  243.     }
  244.     public function getDeletedAt(): ?\DateTimeInterface
  245.     {
  246.         return $this->deletedAt;
  247.     }
  248.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  249.     {
  250.         $this->deletedAt $deletedAt;
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection|OrlProspectOnOrlOffice[]
  255.      */
  256.     public function getOrlProspectsOnOrlOffice(): Collection
  257.     {
  258.         return $this->orlProspectsOnOrlOffice;
  259.     }
  260.     public function addOrlProspectsOnOrlOffice(OrlProspectOnOrlOffice $orlProspectsOnOrlOffice): self
  261.     {
  262.         if (!$this->orlProspectsOnOrlOffice->contains($orlProspectsOnOrlOffice)) {
  263.             $this->orlProspectsOnOrlOffice[] = $orlProspectsOnOrlOffice;
  264.             $orlProspectsOnOrlOffice->setOrlOffice($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeOrlProspectsOnOrlOffice(OrlProspectOnOrlOffice $orlProspectsOnOrlOffice): self
  269.     {
  270.         if ($this->orlProspectsOnOrlOffice->contains($orlProspectsOnOrlOffice)) {
  271.             $this->orlProspectsOnOrlOffice->removeElement($orlProspectsOnOrlOffice);
  272.             // set the owning side to null (unless already changed)
  273.             if ($orlProspectsOnOrlOffice->getOrlOffice() === $this) {
  274.                 $orlProspectsOnOrlOffice->setOrlOffice(null);
  275.             }
  276.         }
  277.         return $this;
  278.     }
  279. }