src/Entity/BatchResult.php line 19
<?phpnamespace App\Entity;use DateTimeImmutable;use App\Enum\BatchResultType;use App\Repository\BatchResultRepository;use Symfony\Component\HttpFoundation\File\File;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\HttpFoundation\File\UploadedFile;#[ORM\Entity(repositoryClass: BatchResultRepository::class)]#[Vich\Uploadable]class BatchResult{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?BatchResultType $type = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $content = null;#[ORM\OneToMany(mappedBy: 'batchResult', targetEntity: BatchResultItem::class, cascade: ['persist', 'remove'], orphanRemoval: true)]private Collection $batchResultItems;#[ORM\Column(type: 'string', length: 255, nullable: true)]private $file;#[Vich\UploadableField(mapping: "batch_result", fileNameProperty: "file")]private $uploadedFile;public function __construct(){$this->batchResultItems = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getType(): ?BatchResultType{return $this->type;}public function setType(BatchResultType $type): static{$this->type = $type;return $this;}public function getContent(): ?string{return $this->content;}public function setContent(?string $content): static{$this->content = $content;return $this;}/*** @return Collection<int, BatchResultItem>*/public function getBatchResultItems(): Collection{return $this->batchResultItems;}public function addBatchResultItem(BatchResultItem $batchResultItem): static{if (!$this->batchResultItems->contains($batchResultItem)) {$this->batchResultItems->add($batchResultItem);$batchResultItem->setBatchResult($this);}return $this;}public function removeBatchResultItem(BatchResultItem $batchResultItem): static{if ($this->batchResultItems->removeElement($batchResultItem)) {// set the owning side to null (unless already changed)if ($batchResultItem->getBatchResult() === $this) {$batchResultItem->setBatchResult(null);}}return $this;}public function getFile(): ?string{return $this->file;}public function setFile(?string $file): self{$this->file = $file;return $this;}/*** If manually uploading a file (i.e. not using Symfony Form) ensure an instance* of 'UploadedFile' is injected into this setter to trigger the update. If this* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter* must be able to accept an instance of 'File' as the bundle will inject one here* during Doctrine hydration.** @param File|UploadedFile|null $uploadedFile*/public function setUploadedFile(?File $uploadedFile = null): void{$this->uploadedFile = $uploadedFile;if (null !== $uploadedFile) {// It is required that at least one field changes if you are using doctrine// otherwise the event listeners won't be called and the file is lost$this->updatedAt = new DateTimeImmutable();}}/*** @return File|null*/public function getUploadedFile(): ?File{return $this->uploadedFile;}}