src/Entity/Laboratoire.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use Application\Sonata\MediaBundle\Entity\Media;
  7. use App\Entity\User;
  8. use App\Entity\Planningg;
  9. use App\Entity\SpecialiteLaboratoire;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. /**
  13.  * @author <erwan> <erwan@kodiom.com>
  14.  *
  15.  * @ORM\Table()
  16.  * @ORM\Entity(repositoryClass="App\Entity\LaboratoireRepository")
  17.  * @ApiResource(
  18.  *     attributes={
  19.  *       "pagination_client_items_per_page"=true,
  20.  *       "filters"={"laboratoire.order", "laboratoire.search", "laboratoire.boolean", "laboratoire.numeric", "laboratoire.date"},
  21.  *       "force_eager"=false,
  22.  *       "normalization_context"={"groups"={"read", "user", "media"}},
  23.  *       "denormalization_context"={"groups"={"read", "user", "media"}}
  24.  *     }
  25.  * )
  26.  */
  27. class Laboratoire
  28. {
  29.     /**
  30.      * @var integer $id
  31.      *
  32.      * @ORM\Id
  33.      * @ORM\Column(type="integer")
  34.      * @ORM\GeneratedValue(strategy="AUTO")
  35.      *
  36.      * @Groups({"read"})
  37.      */
  38.     private $id;
  39.     /**
  40.      * @var text
  41.      *
  42.      * @ORM\Column(name="adresse", type="string", length=255)
  43.      * @Assert\NotBlank()
  44.      * @Groups({"read"})
  45.      */
  46.     private $adresse;
  47.     /**
  48.      * @var text
  49.      *
  50.      * @ORM\Column(name="complement", type="text", nullable=true)
  51.      *
  52.      * @Groups({"read"})
  53.      */
  54.     private $complement;
  55.     /**
  56.      * @var text
  57.      *
  58.      * @ORM\Column(name="codePostal", type="string", length=5)
  59.      * @Assert\NotBlank()
  60.      * @Assert\Length(
  61.      *      min = 5,
  62.      *      max = 5
  63.      * )
  64.      * @Groups({"read"})
  65.      */
  66.     private $codePostal;
  67.     /**
  68.      * @var ArrayCollection
  69.      * @ORM\OneToOne(
  70.      *   targetEntity="App\Entity\User",
  71.      *   cascade={"persist", "remove"},
  72.      *   mappedBy="docteur"
  73.      * )
  74.      * @Groups({"read"})
  75.      */
  76.     private $user;
  77.     /**
  78.      * @var text
  79.      *
  80.      * @ORM\Column(name="honoraire", type="text")
  81.      *
  82.      * @Assert\NotBlank()
  83.      * @Groups({"read"})
  84.      */
  85.     private $honoraire;
  86.     /**
  87.      * @var text
  88.      *
  89.      * @ORM\Column(name="presentation", type="text")
  90.      *
  91.      * @Assert\NotBlank()
  92.      * @Groups({"read"})
  93.      */
  94.     private $presentation;
  95.     /**
  96.      * @var text
  97.      *
  98.      * @ORM\Column(name="formation", type="text")
  99.      *
  100.      * @Assert\NotBlank()
  101.      * @Groups({"read"})
  102.      */
  103.     private $formation;
  104.     /**
  105.      * @var int
  106.      *
  107.      * @ORM\Column(name="noteSite", type="integer")
  108.      *
  109.      * @Assert\NotBlank()
  110.      * @Groups({"read"})
  111.      */
  112.     private $noteSite;
  113.     /**
  114.      * @var int
  115.      *
  116.      * @ORM\Column(name="gainAttente", type="integer")
  117.      *
  118.      * @Assert\NotBlank()
  119.      * @Groups({"read"})
  120.      */
  121.     private $gainAttente;
  122.     /**
  123.      * @var ArrayCollection
  124.      *
  125.      * @ORM\ManyToOne(targetEntity="App\Entity\SpecialiteLaboratoire")
  126.      * @Groups({"read"})
  127.      */
  128.     private $specialite;
  129.     /**
  130.      * @var ArrayCollection
  131.      *
  132.      * @ORM\ManyToMany(targetEntity="App\Entity\Planning", cascade={"persist"}, orphanRemoval=true)
  133.      * @Groups({"read"})
  134.      */
  135.     private $planning;
  136.     /**
  137.      * @var bool
  138.      *
  139.      * @ORM\Column(type="boolean")
  140.      * @Groups({"read"})
  141.      */
  142.     private $abonne;
  143.     /**
  144.      * @var bool
  145.      *
  146.      * @ORM\Column(name="actif", type="boolean")
  147.      * @Groups({"read"})
  148.      */
  149.     private $actif;
  150.     /**
  151.      * Constructor of Laboratoire Entity
  152.      */
  153.     public function __construct()
  154.     {
  155.         $this->noteSite 5;
  156.         $this->gainAttente 0;
  157.         $this->planning = new ArrayCollection();
  158.         $this->abonne true;
  159.         $this->actif true;
  160.     }
  161.     public function __toString()
  162.     {
  163.         return ($this->getUser()) ? $this->getUser()->getUsername() : 'Unknown';
  164.     }
  165.     /**
  166.      * Get id
  167.      *
  168.      * @return integer
  169.      */
  170.     public function getId()
  171.     {
  172.         return $this->id;
  173.     }
  174.     /**
  175.      * Get adresse
  176.      *
  177.      * @return text
  178.      */
  179.     public function getAdresse()
  180.     {
  181.         return $this->adresse;
  182.     }
  183.     /**
  184.      * Set adresse
  185.      *
  186.      * @param text $adresse
  187.      *
  188.      * @return Laboratoire
  189.      */
  190.     public function setAdresse($adresse)
  191.     {
  192.         $this->adresse $adresse;
  193.         return $this;
  194.     }
  195.     /**
  196.      * Get complement
  197.      *
  198.      * @return text
  199.      */
  200.     public function getComplement()
  201.     {
  202.         return $this->complement;
  203.     }
  204.     /**
  205.      * Set adresse
  206.      *
  207.      * @param text $complement
  208.      *
  209.      * @return Laboratoire
  210.      */
  211.     public function setComplement($complement)
  212.     {
  213.         $this->complement $complement;
  214.         return $this;
  215.     }
  216.     /**
  217.      * Get codePostal
  218.      *
  219.      * @return text
  220.      */
  221.     public function getCodePostal()
  222.     {
  223.         return $this->codePostal;
  224.     }
  225.     /**
  226.      * Set codePostal
  227.      *
  228.      * @param text $codePostal
  229.      *
  230.      * @return Laboratoire
  231.      */
  232.     public function setCodePostal($codePostal)
  233.     {
  234.         $this->codePostal $codePostal;
  235.         return $this;
  236.     }
  237.     
  238.     /**
  239.      * Get honoraire
  240.      *
  241.      * @return text
  242.      */
  243.     public function getHonoraire()
  244.     {
  245.         return $this->honoraire;
  246.     }
  247.     /**
  248.      * Set honoraire
  249.      *
  250.      * @param text $honoraire
  251.      *
  252.      * @return Laboratoire
  253.      */
  254.     public function setHonoraire($honoraire)
  255.     {
  256.         $this->honoraire $honoraire;
  257.         return $this;
  258.     }
  259.     /**
  260.      * Get presentation
  261.      *
  262.      * @return text
  263.      */
  264.     public function getPresentation()
  265.     {
  266.         return $this->presentation;
  267.     }
  268.     /**
  269.      * Set presentation
  270.      *
  271.      * @param text $presentation
  272.      *
  273.      * @return Laboratoire
  274.      */
  275.     public function setPresentation($presentation)
  276.     {
  277.         $this->presentation $presentation;
  278.         return $this;
  279.     }
  280.     /**
  281.      * Get formation
  282.      *
  283.      * @return text
  284.      */
  285.     public function getFormation()
  286.     {
  287.         return $this->formation;
  288.     }
  289.     /**
  290.      * Set formation
  291.      *
  292.      * @param text $formation
  293.      *
  294.      * @return Laboratoire
  295.      */
  296.     public function setFormation($formation)
  297.     {
  298.         $this->formation $formation;
  299.         return $this;
  300.     }
  301.     /**
  302.      * Get noteSite
  303.      *
  304.      * @return integer
  305.      */
  306.     public function getNoteSite()
  307.     {
  308.         return $this->noteSite;
  309.     }
  310.     /**
  311.      * Set noteSite
  312.      *
  313.      * @param int $noteSite
  314.      *
  315.      * @return Laboratoire
  316.      */
  317.     public function setNoteSite($noteSite)
  318.     {
  319.         $this->noteSite $noteSite;
  320.         return $this;
  321.     }
  322.     /**
  323.      * Get gainAttente
  324.      *
  325.      * @return integer
  326.      */
  327.     public function getGainAttente()
  328.     {
  329.         return $this->gainAttente;
  330.     }
  331.     /**
  332.      * Set gainAttente
  333.      *
  334.      * @param int $gainAttente
  335.      *
  336.      * @return Laboratoire
  337.      */
  338.     public function setGainAttente($gainAttente)
  339.     {
  340.         $this->gainAttente $gainAttente;
  341.         return $this;
  342.     }
  343.     /**
  344.      * Get specialite
  345.      *
  346.      * @return ArrayCollection
  347.      */
  348.     public function getSpecialite()
  349.     {
  350.         return $this->specialite;
  351.     }
  352.     /**
  353.      * Set specialite
  354.      *
  355.      * @param SpecialiteLaboratoire $specialite
  356.      *
  357.      * @return Laboratoire
  358.      */
  359.     public function setSpecialite(SpecialiteLaboratoire $specialite)
  360.     {
  361.         $this->specialite $specialite;
  362.         return $this;
  363.     }
  364.     /**
  365.      * Get user
  366.      *
  367.      * @return ArrayCollection
  368.      */
  369.     public function getUser()
  370.     {
  371.         return $this->user;
  372.     }
  373.     /**
  374.      * Set user
  375.      *
  376.      * @param User $user
  377.      *
  378.      * @return Laboratoire
  379.      */
  380.     public function setUser(User $user)
  381.     {
  382.         $this->user $user;
  383.         return $this;
  384.     }
  385.     /**
  386.      * Get planning
  387.      *
  388.      * @return \Doctrine\Common\Collections\Collection
  389.      */
  390.     public function getPlanning()
  391.     {
  392.         return $this->planning;
  393.     }
  394.     /**
  395.      * Set planning
  396.      *
  397.      * @param Planning $planning
  398.      *
  399.      * @return Laboratoire
  400.      */
  401.     public function addPlanning(Planning $planning)
  402.     {
  403.         $this->planning[] = $planning;
  404.         return $this;
  405.     }
  406.     /**
  407.      * Set planning
  408.      *
  409.      * @param Planning $planning
  410.      *
  411.      * @return Laboratoire
  412.      */
  413.     public function removePlanning(Planning $planning)
  414.     {
  415.         $this->planning->removeElement($planning);
  416.     }
  417.     /**
  418.      * Get abonne
  419.      *
  420.      * @return boolean
  421.      */
  422.     public function getAbonne()
  423.     {
  424.         return $this->abonne;
  425.     }
  426.     /**
  427.      * Set abonne
  428.      *
  429.      * @param bool $abonne
  430.      *
  431.      * @return Laboratoire
  432.      */
  433.     public function setAbonne($abonne)
  434.     {
  435.         $this->abonne $abonne;
  436.         return $this;
  437.     }
  438.     /**
  439.      * Get actif
  440.      *
  441.      * @return boolean
  442.      */
  443.     public function getActif()
  444.     {
  445.         return $this->actif;
  446.     }
  447.     /**
  448.      * Set actif
  449.      *
  450.      * @param bool $actif
  451.      *
  452.      * @return Laboratoire
  453.      */
  454.     public function setActif($actif)
  455.     {
  456.         $this->actif $actif;
  457.         return $this;
  458.     }
  459. }