src/Entity/TrCoeur.php line 39

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TrCoeurRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Annotation\ApiProperty;
  7. use ApiPlatform\Core\Annotation\ApiFilter;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  10. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Serializer\Annotation\SerializedName;
  13. /**
  14.  * @ORM\Entity(repositoryClass=TrCoeurRepository::class)
  15.  *  @ApiResource(
  16.  *   routePrefix="/v1",
  17.  *   normalizationContext={"groups"={"coeur:read"}},
  18.  *   denormalizationContext={"groups"={"coeur:write"}},
  19.  *   collectionOperations={
  20.  *     "get"={"path"="/tr_coeurs"},
  21.  *     "post"={"path"="/tr_coeurs"}
  22.  *   },
  23.  *   itemOperations={
  24.  *     "get"={"path"="/tr_coeurs/{id}"},
  25.  *     "put"={"path"="/tr_coeurs/{id}"},
  26.  *     "patch"={"path"="/tr_coeurs/{id}"},
  27.  *     "delete"={"path"="/tr_coeurs/{id}"}
  28.  *   }
  29.  * )
  30.  * @ApiFilter(SearchFilter::class, properties={
  31.  *   "PRODUIT.LIBELLE": "partial"
  32.  * })
  33.  * @ApiFilter(DateFilter::class, properties={"DATE_POINTAGE"})
  34.  * @ApiFilter(OrderFilter::class, properties={"DATE_POINTAGE", "id"})
  35.  */
  36. class TrCoeur
  37. {
  38.     /**
  39.      * @ORM\Id
  40.      * @ORM\GeneratedValue
  41.      * @ORM\Column(type="integer")
  42.      * @Groups({"coeur:read"})
  43.      */
  44.     private $id;
  45.     /**
  46.      * @ORM\Column(type="boolean")
  47.      * @Groups({"coeur:read","coeur:write"})
  48.      */
  49.     private $POINTAGE;
  50.     /**
  51.      * @ORM\Column(type="datetime")
  52.      * @Groups({"coeur:read","coeur:write"})
  53.      */
  54.     private $DATE_POINTAGE;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity=TrProduits::class, inversedBy="trCoeurs")
  57.      * @ORM\JoinColumn(nullable=false)
  58.      * @Groups({"coeur:read","coeur:write"})
  59.      * @ApiProperty(readableLink=false, writableLink=true)
  60.      */
  61.     private $PRODUIT;
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function isPOINTAGE(): ?bool
  67.     {
  68.         return $this->POINTAGE;
  69.     }
  70.     public function setPOINTAGE(bool $POINTAGE): self
  71.     {
  72.         $this->POINTAGE = $POINTAGE;
  73.         return $this;
  74.     }
  75.     public function getDATEPOINTAGE(): ?\DateTimeInterface
  76.     {
  77.         return $this->DATE_POINTAGE;
  78.     }
  79.     public function setDATEPOINTAGE(\DateTimeInterface $DATE_POINTAGE): self
  80.     {
  81.         $this->DATE_POINTAGE = $DATE_POINTAGE;
  82.         return $this;
  83.     }
  84.     public function getPRODUIT(): ?TrProduits
  85.     {
  86.         return $this->PRODUIT;
  87.     }
  88.     public function setPRODUIT(?TrProduits $PRODUIT): self
  89.     {
  90.         $this->PRODUIT = $PRODUIT;
  91.         return $this;
  92.     }
  93. }