src/Entity/Catalog.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\CatalogRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ApiResource()
  9.  * @ORM\Entity(repositoryClass=CatalogRepository::class)
  10.  * @ApiResource(
  11.  *     collectionOperations={"get","post"},
  12.  *     itemOperations={"get","put","patch","delete"},
  13.  *     normalizationContext={"groups"={"catalog"}},
  14.  *     denormalizationContext={"groups"={"catalog"}},
  15.  *     attributes={"pagination_enabled"=false}
  16.  * )
  17.  */
  18. class Catalog
  19. {
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Article::class, inversedBy="catalogs")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      * @Groups("catalog")
  30.      */
  31.     private $article;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      * @Groups("catalog")
  35.      */
  36.     private $customer;
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getArticle(): ?Article
  42.     {
  43.         return $this->article;
  44.     }
  45.     public function setArticle(?Article $article): self
  46.     {
  47.         $this->article $article;
  48.         return $this;
  49.     }
  50.     public function getCustomer(): ?string
  51.     {
  52.         return $this->customer;
  53.     }
  54.     public function setCustomer(string $customer): self
  55.     {
  56.         $this->customer $customer;
  57.         return $this;
  58.     }
  59. }