Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Entity;
  4.  
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use App\Repository\AllergyRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9.  
  10.  
  11. /**
  12.  * @ApiResource(
  13.  *    collectionOperations={"get", "post"},
  14.  *    itemOperations={"get", "put", "delete"},
  15.  *    normalizationContext={"groups"={"allergy:read"}},
  16.  * )
  17.  * @ORM\Entity(repositoryClass=AllergyRepository::class)
  18.  */
  19. class Allergy
  20. {
  21.     /**
  22.      * @ORM\Id()
  23.      * @ORM\GeneratedValue()
  24.      * @ORM\Column(type="integer")
  25.      */
  26.     private $id;
  27.  
  28.     /**
  29.      * @ORM\Column(type="string", length=50)
  30.      * @Groups({"allergy:read"})
  31.      */
  32.     private $allergyName;
  33.  
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.  
  39.     public function getAllergyName(): ?string
  40.     {
  41.         return $this->allergyName;
  42.     }
  43.  
  44.     public function setAllergyName(string $allergyName): self
  45.     {
  46.         $this->allergyName = $allergyName;
  47.  
  48.         return $this;
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement