<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\UserLikeListRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: UserLikeListRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['user_like:read']],
denormalizationContext: ['groups' => ['user_like:write']],
order: ['id' => 'DESC'],
)]
#[ApiFilter(
SearchFilter::class,
properties: [
'user.id' => 'exact',
'product.id' => 'exact',
]
)]
class UserLikeList
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['user_like:read', 'user_like:write', 'order_product:read'])]
private ?int $id = null;
#[Groups(['user_like:read', 'user_like:write', 'order_product:read'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_entered = null;
#[Groups(['user_like:read', 'user_like:write', 'order_product:read'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_modified = null;
#[Groups(['user_like:read', 'user_like:write', 'order_product:read'])]
#[ORM\ManyToOne(inversedBy: 'userLikeLists')]
private ?User $user = null;
#[Groups(['user_like:read', 'user_like:write'])]
#[ORM\ManyToOne(inversedBy: 'userLikeLists')]
private ?Products $product = null;
#[Groups(['user_like:read', 'user_like:write', 'order_product:read'])]
#[ORM\Column(nullable: true)]
private ?bool $is_order = null;
public function getId(): ?int
{
return $this->id;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
public function setDateEntered(?\DateTimeInterface $date_entered): self
{
$this->date_entered = $date_entered;
return $this;
}
public function getDateModified(): ?\DateTimeInterface
{
return $this->date_modified;
}
public function setDateModified(?\DateTimeInterface $date_modified): self
{
$this->date_modified = $date_modified;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getProduct(): ?Products
{
return $this->product;
}
public function setProduct(?Products $product): self
{
$this->product = $product;
return $this;
}
public function isIsOrder(): ?bool
{
return $this->is_order;
}
public function setIsOrder(?bool $is_order): self
{
$this->is_order = $is_order;
return $this;
}
}