Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use ApiPlatform\Core\Annotation\ApiResource;
- use App\Repository\AllergyRepository;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Serializer\Annotation\Groups;
- /**
- * @ApiResource(
- * collectionOperations={"get", "post"},
- * itemOperations={"get", "put", "delete"},
- * normalizationContext={"groups"={"allergy:read"}},
- * )
- * @ORM\Entity(repositoryClass=AllergyRepository::class)
- */
- class Allergy
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=50)
- * @Groups({"allergy:read"})
- */
- private $allergyName;
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getAllergyName(): ?string
- {
- return $this->allergyName;
- }
- public function setAllergyName(string $allergyName): self
- {
- $this->allergyName = $allergyName;
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement