<?php
namespace App\Entity;
use App\Repository\ArticleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=ArticleRepository::class)
* @Vich\Uploadable
*/
class Article
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $text;
/**
* @ORM\Column(type="string", length=255, nullable= true)
*/
private $linkLabel;
/**
* @ORM\Column(type="string", length=255, nullable= true)
*/
private $linkUrl;
/**
* @ORM\Column(type="string", length=255, nullable= true)
*/
private $altAttribute;
/**
* @ORM\Column(type="date")
*/
private $creationDate;
/**
* @ORM\Column(type="date")
*/
private $updatedDate;
/**
* @ORM\Column(type="boolean",nullable=true)
*/
private $isActive;
/**
* @ORM\Column(type="boolean",nullable=true)
*/
private $isUne;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $img;
/**
* @Vich\UploadableField(mapping="frontend_image", fileNameProperty="img")
*
* @var File|null
*/
private $imgFile;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $legacyId;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isBlog;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $path;
public function __construct()
{
$this->creationDate = new \Datetime();
$this->updatedDate = new \Datetime();
$this->articleMediaCategories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(string $text): self
{
$this->text = $text;
return $this;
}
public function getLinkLabel(): ?string
{
return $this->linkLabel;
}
public function setLinkLabel(string $linkLabel): self
{
$this->linkLabel = $linkLabel;
return $this;
}
public function getLinkUrl(): ?string
{
return $this->linkUrl;
}
public function setLinkUrl(string $linkUrl): self
{
$this->linkUrl = $linkUrl;
return $this;
}
public function getAltAttribute(): ?string
{
return $this->linkUrl;
}
public function setAltAttribute(string $linkUrl): self
{
$this->linkUrl = $linkUrl;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): self
{
$this->creationDate = $creationDate;
return $this;
}
public function getUpdatedDate(): ?\DateTimeInterface
{
return $this->updatedDate;
}
public function setUpdatedDate(\DateTimeInterface $updatedDate): self
{
$this->updatedDate = $updatedDate;
return $this;
}
public function getIsUne(): ?bool
{
return $this->isUne;
}
public function SetIsUne(bool $isUne): self
{
$this->isUne = $isUne;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getImg(): ?string
{
return $this->img;
}
public function setImg(?string $img): self
{
$this->img = $img;
if($img !== null){
$this->legacyId = 1;
$this->updatedDate = new \DateTime();
}
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|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
*/
public function setImgFile(?File $imageFile = null)
{
$this->imgFile = $imageFile;
if ($imageFile) {
$this->legacyId = 1;
$this->updatedDate = new \DateTime();
}
return true;
}
public function getImgFile(): ?File
{
return $this->imgFile;
}
public function getLegacyId(): ?int
{
return $this->legacyId;
}
public function setLegacyId(?int $legacyId): self
{
$this->legacyId = $legacyId;
return $this;
}
public function getIsBlog(): ?bool
{
return $this->isBlog;
}
public function setIsBlog(?bool $isBlog): self
{
$this->isBlog = $isBlog;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(?string $path): self
{
$this->path = $path;
return $this;
}
}