src/Entity/Client.php line 27

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 Symfony\Component\Serializer\Annotation\Groups;
  6. use ApiPlatform\Core\Annotation\ApiResource;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use App\Repository\ClientRepository;
  10. use App\Entity\User as User;
  11. /**
  12.  * @ORM\Table()
  13.  * @ORM\Entity(repositoryClass=ClientRepository::class)
  14.  * @ApiResource(
  15.  *     attributes={
  16.  *       "filters"={"client.order", "client.filter", "client.boolean"},
  17.  *       "force_eager"=false,
  18.  *       "normalization_context"={"groups"={"read", "user", "media", "read-user"}},
  19.  *       "denormalization_context"={"groups"={"read", "user", "media"}}
  20.  *     }
  21.  * )
  22.  */
  23. class Client
  24. {
  25.     /**
  26.      * @var integer $id
  27.      *
  28.      * @ORM\Id
  29.      * @ORM\Column(type="integer")
  30.      * @ORM\GeneratedValue(strategy="AUTO")
  31.      *
  32.      * @Groups({"read"})
  33.      */
  34.     private $id;
  35.     /**
  36.      * @var text
  37.      *
  38.      * @ORM\Column(name="adresse", type="string", length=255, nullable=true)
  39.      * @Groups({"read","user"})
  40.      */
  41.     private $adresse;
  42.     /**
  43.      * @var text
  44.      *
  45.      * @ORM\Column(name="poids", type="string", length=50, nullable=true)
  46.      * @Groups({"read","user"})
  47.      */
  48.     private $poids;
  49.     /**
  50.      * @var text
  51.      *
  52.      * @ORM\Column(name="taille", type="string", length=50, nullable=true)
  53.      * @Groups({"read","user"})
  54.      */
  55.     private $taille;
  56.     /**
  57.      * @var text
  58.      *
  59.      * @ORM\Column(name="groupeSanguin", type="string", length=50, nullable=true)
  60.      * @Groups({"read","user"})
  61.      */
  62.     private $groupeSanguin;
  63.     /**
  64.      * @var text
  65.      *
  66.      * @ORM\Column(name="allergie", type="string", length=255, nullable=true)
  67.      * @Groups({"read","user"})
  68.      */
  69.     private $allergie;
  70.     /**
  71.      * @var User
  72.      * @ORM\OneToOne(
  73.      *   targetEntity="App\Entity\User",
  74.      *   cascade={"persist", "remove"},
  75.      *   mappedBy="client"
  76.      * )
  77.      * @Groups({"user"})
  78.      */
  79.     private $user;
  80.     /**
  81.      * @var datetime
  82.      *
  83.      * @ORM\Column(name="dateInfo", type="date")
  84.      *
  85.      * @Assert\NotBlank()
  86.      * @Groups({"read"})
  87.      */
  88.     private $dateInfo;
  89.     /**
  90.      * @var bool
  91.      *
  92.      * @ORM\Column(name="invite", type="boolean")
  93.      * @Groups({"read","user"})
  94.      */
  95.     private $invite;
  96.     /**
  97.      * @var bool
  98.      *
  99.      * @ORM\Column(name="actif", type="boolean")
  100.      * @Groups({"read","user"})
  101.      */
  102.     private $actif;
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=Ordonnance::class, mappedBy="client")
  105.      */
  106.     private $ordonnances;
  107.     /**
  108.      * @ORM\OneToMany(targetEntity=ArretTravail::class, mappedBy="client")
  109.      */
  110.     private $arrets;
  111.     /**
  112.      * @ORM\OneToMany(targetEntity=FeuilleSoin::class, mappedBy="client")
  113.      */
  114.     private $feuilles;
  115.     /**
  116.      * Constructor of Client Entity
  117.      */
  118.     public function __construct()
  119.     {
  120.         $this->invite false;
  121.         $this->actif true;
  122.         $this->dateInfo = new \DateTime;
  123.         $this->ordonnances = new ArrayCollection();
  124.         $this->arrets = new ArrayCollection();
  125.         $this->feuilles = new ArrayCollection();
  126.     }
  127.     public function __toString()
  128.     {
  129.         return ($this->getUser()) ? $this->getUser()->getUsername() : 'Unknown';
  130.     }
  131.     /**
  132.      * Get id
  133.      *
  134.      * @return integer
  135.      */
  136.     public function getId()
  137.     {
  138.         return $this->id;
  139.     }
  140.     /**
  141.      * Get adresse
  142.      *
  143.      * @return string
  144.      */
  145.     public function getAdresse()
  146.     {
  147.         return $this->adresse;
  148.     }
  149.     /**
  150.      * Set adresse
  151.      *
  152.      * @param string $adresse
  153.      *
  154.      * @return Client
  155.      */
  156.     public function setAdresse($adresse)
  157.     {
  158.         $this->adresse $adresse;
  159.         return $this;
  160.     }
  161.     /**
  162.      * Get poids
  163.      *
  164.      * @return string
  165.      */
  166.     public function getPoids()
  167.     {
  168.         return $this->poids;
  169.     }
  170.     /**
  171.      * Set poids
  172.      *
  173.      * @param string $poids
  174.      *
  175.      * @return Client
  176.      */
  177.     public function setPoids($poids)
  178.     {
  179.         $this->poids $poids;
  180.         return $this;
  181.     }
  182.     /**
  183.      * Get taille
  184.      *
  185.      * @return string
  186.      */
  187.     public function getTaille()
  188.     {
  189.         return $this->taille;
  190.     }
  191.     /**
  192.      * Set taille
  193.      *
  194.      * @param string $taille
  195.      *
  196.      * @return Client
  197.      */
  198.     public function setTaille($taille)
  199.     {
  200.         $this->taille $taille;
  201.         return $this;
  202.     }
  203.     /**
  204.      * Get groupeSanguin
  205.      *
  206.      * @return string
  207.      */
  208.     public function getGroupeSanguin()
  209.     {
  210.         return $this->groupeSanguin;
  211.     }
  212.     /**
  213.      * Set groupeSanguin
  214.      *
  215.      * @param string $groupeSanguin
  216.      *
  217.      * @return Client
  218.      */
  219.     public function setGroupeSanguin($groupeSanguin)
  220.     {
  221.         $this->groupeSanguin $groupeSanguin;
  222.         return $this;
  223.     }
  224.     /**
  225.      * Get allergie
  226.      *
  227.      * @return string
  228.      */
  229.     public function getAllergie()
  230.     {
  231.         return $this->allergie;
  232.     }
  233.     /**
  234.      * Set allergie
  235.      *
  236.      * @param string $allergie
  237.      *
  238.      * @return Client
  239.      */
  240.     public function setAllergie($allergie)
  241.     {
  242.         $this->allergie $allergie;
  243.         return $this;
  244.     }
  245.     /**
  246.      * Get user
  247.      *
  248.      * @return User
  249.      */
  250.     public function getUser()
  251.     {
  252.         return $this->user;
  253.     }
  254.     /**
  255.      * Set user
  256.      *
  257.      * @param User $user
  258.      *
  259.      * @return Client
  260.      */
  261.     public function setUser(User $user)
  262.     {
  263.         $this->user $user;
  264.         return $this;
  265.     }
  266.     /**
  267.      * Get dateInfo
  268.      *
  269.      * @return datetime
  270.      */
  271.     public function getDateInfo()
  272.     {
  273.         return $this->dateInfo;
  274.     }
  275.     /**
  276.      * Set dateInfo
  277.      *
  278.      * @param datetime $dateInfo
  279.      *
  280.      * @return Intervention
  281.      */
  282.     public function setDateInfo($dateInfo)
  283.     {
  284.         $this->dateInfo $dateInfo;
  285.         return $this;
  286.     }
  287.     /**
  288.      * Get getDateInfoInfoString
  289.      *
  290.      * @return \DateTime
  291.      * @Groups({"read"})
  292.      */
  293.     public function getDateInfoInfoString()
  294.     {
  295.         return $this->dateInfo->format('Y-m-d');
  296.     }
  297.     /**
  298.      * Get invite
  299.      *
  300.      * @return boolean
  301.      */
  302.     public function getInvite()
  303.     {
  304.         return $this->invite;
  305.     }
  306.     /**
  307.      * Set invite
  308.      *
  309.      * @param bool $invite
  310.      *
  311.      * @return Client
  312.      */
  313.     public function setInvite($invite)
  314.     {
  315.         $this->invite $invite;
  316.         return $this;
  317.     }
  318.     /**
  319.      * Get actif
  320.      *
  321.      * @return boolean
  322.      */
  323.     public function getActif()
  324.     {
  325.         return $this->actif;
  326.     }
  327.     /**
  328.      * Set actif
  329.      *
  330.      * @param bool $actif
  331.      *
  332.      * @return Client
  333.      */
  334.     public function setActif($actif)
  335.     {
  336.         $this->actif $actif;
  337.         return $this;
  338.     }
  339.     /**
  340.      * @return mixed
  341.      */
  342.     public function getOrdonnances()
  343.     {
  344.         return $this->ordonnances;
  345.     }
  346.     /**
  347.      * @param mixed $ordonnances
  348.      */
  349.     public function setOrdonnances($ordonnances)
  350.     {
  351.         $this->ordonnances $ordonnances;
  352.     }
  353. }