57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Enum\Status;
|
|
use App\Repository\ProductRepository;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ProductRepository::class)]
|
|
class Product
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $name = null;
|
|
|
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
|
private ?string $description = null;
|
|
|
|
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
|
|
private ?string $price = null;
|
|
|
|
#[ORM\Column]
|
|
private ?int $stock = null;
|
|
|
|
#[ORM\Column]
|
|
private bool $published = false;
|
|
|
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
|
private ?\DateTimeImmutable $releasedAt = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?\DateTimeImmutable $updatedAt = null;
|
|
|
|
#[ORM\Column(length: 180)]
|
|
private ?string $contactEmail = null;
|
|
|
|
#[ORM\Column(enumType: Status::class)]
|
|
private ?Status $status = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'products')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Category $category = null;
|
|
|
|
/** @var Collection<int, Tag> */
|
|
#[ORM\ManyToMany(targetEntity: Tag::class)]
|
|
private Collection $tags;
|
|
|
|
/** @var Collection<int, Review> */
|
|
#[ORM\OneToMany(targetEntity: Review::class, mappedBy: 'product')]
|
|
private Collection $reviews;
|
|
}
|