-
PEREZ-RAMIREZ Julian authoredPEREZ-RAMIREZ Julian authored
WishList.php 2.64 KiB
<?php
namespace App\Entity;
use App\Repository\WishListRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: WishListRepository::class)]
class WishList
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\ManyToMany(targetEntity: Item::class)]
#[ORM\JoinTable(name: "wishlist_item")]
private Collection $items;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $expiration_date = null;
#[ORM\Column]
private ?bool $is_active = null;
#[ORM\Column]
private ?\DateTimeImmutable $created_at = null;
public function __construct()
{
$this->items = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getExpirationDate(): ?\DateTimeInterface
{
return $this->expiration_date;
}
public function setExpirationDate(?\DateTimeInterface $expiration_date): static
{
$this->expiration_date = $expiration_date;
return $this;
}
public function isActive(): ?bool
{
return $this->is_active;
}
public function setIsActive(bool $is_active): static
{
$this->is_active = $is_active;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): static
{
$this->created_at = $created_at;
return $this;
}
/**
* @return Collection<int, Item>
*/
public function getItems(): Collection
{
return $this->items;
}
public function addItem(Item $item): static
{
if (!$this->items->contains($item)) {
$this->items->add($item);
}
return $this;
}
public function removeItem(Item $item): static
{
$this->items->removeElement($item);
return $this;
}
}