src/Entity/UserLikeList.php line 26

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.     ]
  22. )]
  23. class UserLikeList
  24. {
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     #[Groups(['user_like:read''user_like:write',  'order_product:read'])]
  29.     private ?int $id null;
  30.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  31.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  32.     private ?\DateTimeInterface $date_entered null;
  33.     #[Groups(['user_like:read''user_like:write',  'order_product:read'])]
  34.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  35.     private ?\DateTimeInterface $date_modified null;
  36.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  37.     #[ORM\ManyToOne(inversedBy'userLikeLists')]
  38.     private ?User $user null;
  39.     #[Groups(['user_like:read''user_like:write'])]
  40.     #[ORM\ManyToOne(inversedBy'userLikeLists')]
  41.     private ?Products $product null;
  42.     #[Groups(['user_like:read''user_like:write''order_product:read'])]
  43.     #[ORM\Column(nullabletrue)]
  44.     private ?bool $is_order null;
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getDateEntered(): ?\DateTimeInterface
  50.     {
  51.         return $this->date_entered;
  52.     }
  53.     public function setDateEntered(?\DateTimeInterface $date_entered): self
  54.     {
  55.         $this->date_entered $date_entered;
  56.         return $this;
  57.     }
  58.     public function getDateModified(): ?\DateTimeInterface
  59.     {
  60.         return $this->date_modified;
  61.     }
  62.     public function setDateModified(?\DateTimeInterface $date_modified): self
  63.     {
  64.         $this->date_modified $date_modified;
  65.         return $this;
  66.     }
  67.     public function getUser(): ?User
  68.     {
  69.         return $this->user;
  70.     }
  71.     public function setUser(?User $user): self
  72.     {
  73.         $this->user $user;
  74.         return $this;
  75.     }
  76.     public function getProduct(): ?Products
  77.     {
  78.         return $this->product;
  79.     }
  80.     public function setProduct(?Products $product): self
  81.     {
  82.         $this->product $product;
  83.         return $this;
  84.     }
  85.     public function isIsOrder(): ?bool
  86.     {
  87.         return $this->is_order;
  88.     }
  89.     public function setIsOrder(?bool $is_order): self
  90.     {
  91.         $this->is_order $is_order;
  92.         return $this;
  93.     }
  94. }