<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use App\Repository\ArticleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @Vich\Uploadable
* @ORM\Entity(repositoryClass=ArticleRepository::class)
* @ORM\Table(name="app_article")
*/
class Article
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $descriptionLocal = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $imageName = null;
/**
* @Vich\UploadableField(mapping="article_images", fileNameProperty="imageName")
*/
private ?File $imageFile = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $imageNameKg = null;
/**
* @Vich\UploadableField(mapping="article_images", fileNameProperty="imageName")
*/
private ?File $imageFileKg = null;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Survey", inversedBy="article")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private ?Survey $survey;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Survey", mappedBy="articles")
*/
private Collection $surveys;
/**
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
*/
private \DateTimeInterface $updatedAt;
/**
* @ORM\Column(type="integer", options={"default": 0}, nullable=true)
*/
private ?int $scoreFrom = 0;
/**
* @ORM\Column(type="integer", options={"default": 0}, nullable=true)
*/
private ?int $scoreTo = 0;
public function __construct()
{
$this->surveys = new ArrayCollection();
}
public function getId(): int
{
return $this->id;
}
public function __toString(): string
{
return $this->getDescription();
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescriptionLocal(): ?string
{
return $this->descriptionLocal;
}
public function setDescriptionLocal(?string $descriptionLocal): self
{
$this->descriptionLocal = $descriptionLocal;
return $this;
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageFileKg(?File $imageFileKg = null): void
{
$this->imageFileKg = $imageFileKg;
if (null !== $imageFileKg) {
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getImageFileKg(): ?File
{
return $this->imageFileKg;
}
public function setImageNameKg(?string $imageNameKg): void
{
$this->imageNameKg = $imageNameKg;
}
public function getImageNameKg(): ?string
{
return $this->imageNameKg;
}
public function getSurvey(): ?Survey
{
return $this->survey;
}
public function setSurvey(?Survey $survey): self
{
$this->survey = $survey;
return $this;
}
public function getScoreTo(): ?int
{
return $this->scoreTo;
}
public function setScoreTo(?int $scoreTo): self
{
$this->scoreTo = $scoreTo;
return $this;
}
public function getScoreFrom(): ?int
{
return $this->scoreFrom;
}
public function setScoreFrom(?int $scoreFrom): self
{
$this->scoreFrom = $scoreFrom;
return $this;
}
/** @return Collection<int, Survey> */
public function getSurveys(): Collection
{
return $this->surveys;
}
public function addSurvey(Survey $survey): self
{
if (!$this->surveys->contains($survey)) {
$this->surveys->add($survey);
}
return $this;
}
public function removeSurvey(Survey $survey): self
{
$this->surveys->removeElement($survey);
return $this;
}
}