<?phpdeclare(strict_types=1);namespace App\Order\Doctrine\Entity;use App\Supplier\Doctrine\Entity\Supplier;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping\Column;use Doctrine\ORM\Mapping\Entity;use Doctrine\ORM\Mapping\GeneratedValue;use Doctrine\ORM\Mapping\Id;use Doctrine\ORM\Mapping\JoinColumn;use Doctrine\ORM\Mapping\ManyToOne;use Doctrine\ORM\Mapping\OneToMany;use Doctrine\ORM\Mapping\Table;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Validator\Constraints\NotBlank;use Symfony\Component\Validator\Constraints\NotNull;use Vich\UploaderBundle\Mapping\Annotation\Uploadable;use Vich\UploaderBundle\Mapping\Annotation\UploadableField;#[Uploadable]#[Entity]#[Table(name: 'order_bill')]class Bill{ #[Id] #[Column(type: 'integer')] #[GeneratedValue] private ?int $id = null; #[Column(type: 'date_immutable')] #[NotBlank] private DateTimeImmutable $createdAt; #[ManyToOne(targetEntity: Supplier::class)] #[JoinColumn(nullable: false)] #[NotNull] private Supplier $supplier; /** * @var Collection<int, Detail> */ #[OneToMany(mappedBy: 'bill', targetEntity: Detail::class)] private Collection $details; #[Column] private string $path; #[UploadableField(mapping: 'bills', fileNameProperty: 'path')] private ?File $file = null; public function __construct() { $this->details = new ArrayCollection(); $this->createdAt = new DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(DateTimeImmutable $createdAt): void { $this->createdAt = $createdAt; } public function getSupplier(): Supplier { return $this->supplier; } public function setSupplier(Supplier $supplier): void { $this->supplier = $supplier; } /** * @return Collection<int, Detail> */ public function getDetails(): Collection { return $this->details; } /** * @param Collection $details */ public function setDetails(Collection $details): void { $this->details = $details; } public function removeDetail(Detail $detail): void { $this->details->removeElement($detail); } public function addDetail(Detail $detail): self { if (!$this->details->contains($detail)) { $this->details[] = $detail; $detail->setBill($this); } return $this; } public function getPath(): string { return $this->path; } public function setPath(string $path): void { $this->path = $path; } public function getFile(): ?File { return $this->file; } public function setFile(?File $file): void { $this->file = $file; }}