src/Entity/UserLikeList.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\UserLikeListRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use ApiPlatform\Metadata\ApiFilter;
  8. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ORM\Entity(repositoryClassUserLikeListRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['user_like:read']],
  13.     denormalizationContext: ['groups' => ['user_like:write']],
  14.     order: ['id' => 'DESC'],
  15. )]
  16. #[ApiFilter(
  17.     SearchFilter::class, 
  18.     properties: [
  19.         'user.id' => 'exact'
  20.         'product.id' => 'exact'
  21.         'siteProduct.id' => 'exact'
  22.     ]
  23. )]
  24. class UserLikeList
  25. {
  26.     #[ORM\Id]
  27.     #[ORM\GeneratedValue]
  28.     #[ORM\Column]
  29.     #[Groups(['user_like:read''user_like:write',  'order_product:read'])]
  30.     private ?int $id null;
  31.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  32.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  33.     private ?\DateTimeInterface $date_entered null;
  34.     #[Groups(['user_like:read''user_like:write',  'order_product:read'])]
  35.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  36.     private ?\DateTimeInterface $date_modified null;
  37.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  38.     #[ORM\ManyToOne(inversedBy'userLikeLists')]
  39.     private ?User $user null;
  40.     #[Groups(['user_like:read''user_like:write'])]
  41.     #[ORM\ManyToOne(inversedBy'userLikeLists')]
  42.     private ?Products $product null;
  43.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  44.     #[ORM\Column(nullabletrue)]
  45.     private ?bool $is_order null;
  46.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  47.     #[ORM\ManyToOne(inversedBy'userLikeLists')]
  48.     private ?SiteProducts $siteProduct null;
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getDateEntered(): ?\DateTimeInterface
  54.     {
  55.         return $this->date_entered;
  56.     }
  57.     public function setDateEntered(?\DateTimeInterface $date_entered): self
  58.     {
  59.         $this->date_entered $date_entered;
  60.         return $this;
  61.     }
  62.     public function getDateModified(): ?\DateTimeInterface
  63.     {
  64.         return $this->date_modified;
  65.     }
  66.     public function setDateModified(?\DateTimeInterface $date_modified): self
  67.     {
  68.         $this->date_modified $date_modified;
  69.         return $this;
  70.     }
  71.     public function getUser(): ?User
  72.     {
  73.         return $this->user;
  74.     }
  75.     public function setUser(?User $user): self
  76.     {
  77.         $this->user $user;
  78.         return $this;
  79.     }
  80.     public function getProduct(): ?Products
  81.     {
  82.         return $this->product;
  83.     }
  84.     public function setProduct(?Products $product): self
  85.     {
  86.         $this->product $product;
  87.         return $this;
  88.     }
  89.     public function isIsOrder(): ?bool
  90.     {
  91.         return $this->is_order;
  92.     }
  93.     public function setIsOrder(?bool $is_order): self
  94.     {
  95.         $this->is_order $is_order;
  96.         return $this;
  97.     }
  98.     public function getSiteProduct(): ?SiteProducts
  99.     {
  100.         return $this->siteProduct;
  101.     }
  102.     public function setSiteProduct(?SiteProducts $siteProduct): static
  103.     {
  104.         $this->siteProduct $siteProduct;
  105.         return $this;
  106.     }
  107. }