src/Entity/Salon.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\RDV;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * Salon
  9.  *
  10.  * @ORM\Table(name="salon")
  11.  * @ORM\Entity
  12.  */
  13. class Salon
  14. {
  15.     const SERVICE_COIFFURE 'coiffure';
  16.     const SERVICE_ESTHETIQUE 'esthetique';
  17.     const DEFAULT_OPENING_TIME '10:00:00';
  18.     const DEFAULT_CLOSING_TIME '18:00:00';
  19.     /**
  20.      * @var int
  21.      * @Groups("rdv")
  22.      * @ORM\Column(name="id", type="integer", nullable=false)
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="IDENTITY")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @Groups("rdv")
  29.      * @var string
  30.      *
  31.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  32.      */
  33.     private $name;
  34.     /**
  35.      * @var string
  36.      *
  37.      * @ORM\Column(name="service", type="string", nullable=true)
  38.      */
  39.     private $service;
  40.     /**
  41.      * @var bool
  42.      *
  43.      * @ORM\Column(name="status", type="boolean", nullable=false)
  44.      */
  45.     private $status;
  46.     /**
  47.      * @var array
  48.      *
  49.      * @ORM\Column(name="openingDays", type="array", nullable=true)
  50.      */
  51.     private $openingDays;
  52.     /**
  53.      * @var \DateTime
  54.      *
  55.      * @ORM\Column(name="date_activity_end", type="string", nullable=true)
  56.      */
  57.     private $dateActivityEnd;
  58.     /**
  59.      * @var \DateTime
  60.      *
  61.      * @ORM\Column(name="specific_billing", type="boolean", nullable=true)
  62.      */
  63.     private $specificBilling false;
  64.     /**
  65.      * @var \DateTime
  66.      *
  67.      * @ORM\Column(name="date_open", type="string", nullable=true)
  68.      */
  69.     private $dateOpen;
  70.     /**
  71.      * @var \DateTime
  72.      *
  73.      * @ORM\Column(name="date_end", type="string", nullable=true)
  74.      */
  75.     private $dateEnd;
  76.     /**
  77.      * @ORM\OneToMany(targetEntity="IntervenantSalon", mappedBy="salon", cascade={"persist"})
  78.      */
  79.     protected $intervenantSalons;
  80.     /**
  81.      * @ORM\OneToMany(targetEntity="RDV", mappedBy="salon")
  82.      */
  83.     protected $rdvs;
  84.     /**
  85.      * @Groups("rdv")
  86.      * @var Address
  87.      *
  88.      * @ORM\ManyToOne(targetEntity="Address", cascade={"persist"})
  89.      * @ORM\JoinColumn(name="address_id", referencedColumnName="id")
  90.      */
  91.     private $address;
  92.     /**
  93.      * @var GridPrice
  94.      *
  95.      * @ORM\ManyToOne(targetEntity=GridPrice::class, cascade={"persist"})
  96.      * @ORM\JoinColumn(name="gridprice_id", referencedColumnName="id")
  97.      */
  98.     private $gridPrice;
  99.     /**
  100.      * @var Site
  101.      *
  102.      * @ORM\ManyToOne(targetEntity="Site")
  103.      * @ORM\JoinColumn(name="site_id", referencedColumnName="id")
  104.      */
  105.     private $site;
  106.     /**
  107.      * @ORM\Column(type="time", nullable=true)
  108.      */
  109.     private $openingTime;
  110.     /**
  111.      * @ORM\Column(type="time", nullable=true)
  112.      */
  113.     private $closingTime;
  114.     public function __toString()
  115.                       {
  116.                           return $this->name;
  117.                       }
  118.     public function __construct()
  119.                       {
  120.                           //        $this->dateEnd = new \DateTime();
  121.                           //        $this->dateActivityEnd = new \DateTime();
  122.                           //        $this->dateOpen = new \DateTime();
  123.                           $this->intervenantSalons = new ArrayCollection();
  124.                         $this->rdvs = new ArrayCollection();
  125.                       }
  126.     public function getId(): ?int
  127.                       {
  128.                           return $this->id;
  129.                       }
  130.     public function getName(): ?string
  131.                       {
  132.                           return $this->name;
  133.                       }
  134.     public function setName(string $name): self
  135.                       {
  136.                           $this->name $name;
  137.                           return $this;
  138.                       }
  139.     public function getStatus(): ?bool
  140.                       {
  141.                           return $this->status;
  142.                       }
  143.     public function setStatus(bool $status): self
  144.                       {
  145.                           $this->status $status;
  146.                           return $this;
  147.                       }
  148.     public function getDateActivityEnd()
  149.                       {
  150.                           return $this->dateActivityEnd;
  151.                       }
  152.     public function setDateActivityEnd($dateActivityEnd): self
  153.                       {
  154.                           $this->dateActivityEnd $dateActivityEnd;
  155.                           return $this;
  156.                       }
  157.     public function getDateEnd()
  158.                       {
  159.                           return $this->dateEnd;
  160.                       }
  161.     public function setDateEnd($dateEnd): self
  162.                       {
  163.                           $this->dateEnd $dateEnd;
  164.                           return $this;
  165.                       }
  166.     public function getAddress(): ?Address
  167.                       {
  168.                           return $this->address;
  169.                       }
  170.     public function setAddress(?Address $address): self
  171.                       {
  172.                           $this->address $address;
  173.                           return $this;
  174.                       }
  175.     /**
  176.      * @return Site|null
  177.      */
  178.     public function getSite(): ?Site
  179.                       {
  180.                           return $this->site;
  181.                       }
  182.     /**
  183.      * @param Site $site
  184.      */
  185.     public function setSite(Site $site): void
  186.                       {
  187.                           $this->site $site;
  188.                       }
  189.     /**
  190.      * @return string
  191.      */
  192.     public function getService(): ?string
  193.                       {
  194.                           return $this->service;
  195.                       }
  196.     /**
  197.      * @param string $service
  198.      */
  199.     public function setService(string $service): void
  200.                       {
  201.                           $this->service $service;
  202.                       }
  203.     /**
  204.      * @return \DateTime
  205.      */
  206.     public function getDateOpen()
  207.                       {
  208.                           return $this->dateOpen;
  209.                       }
  210.     /**
  211.      * @param \DateTime $dateOpen
  212.      */
  213.     public function setDateOpen($dateOpen): void
  214.                       {
  215.                           $this->dateOpen $dateOpen;
  216.                       }
  217.     /**
  218.      * @return array
  219.      */
  220.     public function getOpeningDays(): ?array
  221.                       {
  222.                           return $this->openingDays;
  223.                       }
  224.     /**
  225.      * @param array $openingDays
  226.      */
  227.     public function setOpeningDays(array $openingDays): void
  228.                       {
  229.                           $this->openingDays $openingDays;
  230.                       }
  231.     /**
  232.      * @return
  233.      */
  234.     public function getIntervenantSalons()
  235.                       {
  236.                           return $this->intervenantSalons;
  237.                       }
  238.     /**
  239.      * @param Intervenant $intervenantSalons
  240.      */
  241.     public function setIntervenantSalons(Intervenant $intervenantSalons): void
  242.                       {
  243.                           $this->intervenantSalons $intervenantSalons;
  244.                       }
  245.     /**
  246.      * @return \DateTime
  247.      */
  248.     public function getSpecificBilling(): ?bool
  249.                       {
  250.                           return $this->specificBilling;
  251.                       }
  252.     /**
  253.      * @param $specificBilling
  254.      */
  255.     public function setSpecificBilling($specificBilling): void
  256.                       {
  257.                           $this->specificBilling $specificBilling;
  258.                       }
  259.     /*********/
  260.     /*  ADD */
  261.     /********/
  262.     public function addIntervenantSalon(IntervenantSalon $item)
  263.                       {
  264.                           $this->intervenantSalons->add($item);
  265.                           $item->setSalon($this);
  266.                       }
  267.     /*********/
  268.     /*  REMOVE */
  269.     /********/
  270.     public function removeIntervenantSalon(IntervenantSalon $item)
  271.                       {
  272.                           $this->intervenantSalons->removeElement($item);
  273.                       }
  274.     /**
  275.      * @return GridPrice
  276.      */
  277.     public function getGridPrice(): ?GridPrice
  278.                       {
  279.                           return $this->gridPrice;
  280.                       }
  281.     /**
  282.      * @param GridPrice $gridPrice
  283.      */
  284.     public function setGridPrice(GridPrice $gridPrice): void
  285.                       {
  286.                           $this->gridPrice $gridPrice;
  287.                       }
  288.     public static function getServices(): array
  289.                       {
  290.                           return [
  291.                               self::SERVICE_COIFFURE => 'COIFFURE',
  292.                               self::SERVICE_ESTHETIQUE => 'ESTHETIQUE',
  293.                           ];
  294.                       }
  295.     public function getOpeningTime(): ?\DateTimeInterface
  296.     {
  297.         return $this->openingTime;
  298.     }
  299.     public function setOpeningTime(?\DateTimeInterface $openingTime): self
  300.     {
  301.         $this->openingTime $openingTime;
  302.         return $this;
  303.     }
  304.     public function getClosingTime(): ?\DateTimeInterface
  305.     {
  306.         return $this->closingTime;
  307.     }
  308.     public function setClosingTime(?\DateTimeInterface $closingTime): self
  309.     {
  310.         $this->closingTime $closingTime;
  311.         return $this;
  312.     }
  313.     /**
  314.      * @return ArrayCollection
  315.      */
  316.     public function getRdvs()
  317.     {
  318.         return $this->rdvs;
  319.     }
  320.     /**
  321.      * @param ArrayCollection $rdvs
  322.      */
  323.     public function setRdvs($rdvs): void
  324.     {
  325.         $this->rdvs $rdvs;
  326.     }
  327. }