<?phpnamespace App\Entity\Gos;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * @ORM\Entity(repositoryClass="App\Repository\Gos\AdvertRepository") * @ORM\HasLifecycleCallbacks() * @Vich\Uploadable() */class Advert{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="integer") */ private $position; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; /** * @Vich\UploadableField(mapping="advert_image", fileNameProperty="imageFilename") */ private $image; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $imageFilename; /** * @ORM\Column(type="boolean") */ private $isActive; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToOne(targetEntity=Coupon::class) */ private $coupon; /** @ORM\PrePersist() */ public function onPrePersist() { $this->createdAt = new \DateTime(); } /** @ORM\PreUpdate() */ public function onPreUpdate() { $this->updatedAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getPosition(): ?int { return $this->position; } public function setPosition(int $position): self { $this->position = $position; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function setImage(?File $image = null): void { $this->image = $image; if ($image !== null) { $this->updatedAt = new \DateTimeImmutable(); } } public function getImage(): ?File { return $this->image; } public function getImageFilename(): ?string { return $this->imageFilename; } public function setImageFilename(?string $imageFilename): self { $this->imageFilename = $imageFilename; return $this; } public function getIsActive(): ?bool { return $this->isActive; } public function setIsActive(bool $isActive): self { $this->isActive = $isActive; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getCoupon(): ?Coupon { return $this->coupon; } public function setCoupon(?Coupon $coupon): self { $this->coupon = $coupon; return $this; }}