<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\ArticlesRepository")
*/
class Articles
{
public function __construct(){
$this->date = new \DateTime;
$this->isEnabled = false;
$this->isVisible = true;
$this->isDeleted = false;
$this->tags = new ArrayCollection();
}
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255,nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="content", type="text",nullable=true)
*/
private $content;
/**
* @var string
*
* @ORM\Column(name="slug", type="string", length=255,nullable=true)
*/
private $slug;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime", nullable=true)
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="lastUpdate", type="datetime", nullable=true)
*/
private $lastUpdate;
/**
* @var \DateTime|null
*
* @ORM\Column(name="date", type="datetime", nullable=true)
*/
private $date;
/**
* @var bool
*
* @ORM\Column(name="isEnabled", type="boolean", nullable=true)
*/
private $isEnabled;
/**
* @var bool
*
* @ORM\Column(name="isOnFrontPage", type="boolean", nullable=true)
*/
private $isOnFrontPage;
/**
* @var bool
*
* @ORM\Column(name="isVisible", type="boolean",nullable=true)
*/
private $isVisible;
/**
* @var bool
*
* @ORM\Column(name="isDeleted", type="boolean",nullable=true)
*/
private $isDeleted;
/**
* @var string
*
* @ORM\Column(name="youtube", type="string", length=255, nullable=true)
*/
private $youtube;
/**
* @var string
*
* @ORM\Column(name="flickr", type="string", length=255, nullable=true)
*/
private $flickr;
/**
* @var string
*
* @ORM\Column(name="URL", type="string", length=255, nullable=true)
*/
private $URL;
/**
* @var string
*
* @ORM\Column(name="soundcloud", type="string", length=255, nullable=true)
*/
private $soundcloud;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Users")
* @ORM\JoinColumn(name="updatedBy",nullable=true)
*/
private $updatedBy;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Picture", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $banner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ArticlesCategories", inversedBy="articles", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $category;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ArticlesTypes",inversedBy="articles", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $type;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Users", fetch="EAGER")
*/
private $user;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Albums", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $album;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Biblios", cascade={"persist","remove"}, orphanRemoval=true, fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $biblio;
/**
* @ORM\ManyToMany(targetEntity=Tags::class)
*/
private $tags;
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $date): self
{
$this->createdAt = $date;
return $this;
}
public function getLastUpdate(): ?\DateTimeInterface
{
return $this->lastUpdate;
}
public function setLastUpdate(\DateTimeInterface $lastUpdate): self
{
$this->lastUpdate = $lastUpdate;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getIsEnabled(): ?bool
{
return $this->isEnabled;
}
public function setIsEnabled(?bool $isEnabled): self
{
$this->isEnabled = $isEnabled;
return $this;
}
public function getIsOnFrontPage(): ?bool
{
return $this->isOnFrontPage;
}
public function setIsOnFrontPage(?bool $isOnFrontPage): self
{
$this->isOnFrontPage = $isOnFrontPage;
return $this;
}
public function getIsVisible(): ?bool
{
return $this->isVisible;
}
public function setIsVisible(?bool $isVisible): self
{
$this->isVisible = $isVisible;
return $this;
}
public function getIsDeleted(): ?bool
{
return $this->isDeleted;
}
public function setIsDeleted(?bool $isDeleted): self
{
$this->isDeleted = $isDeleted;
return $this;
}
public function getYoutube(): ?string
{
return $this->youtube;
}
public function setYoutube(?string $youtube): self
{
$this->youtube = $youtube;
return $this;
}
public function getFlickr(): ?string
{
return $this->flickr;
}
public function setFlickr(?string $flickr): self
{
$this->flickr = $flickr;
return $this;
}
public function getURL(): ?string
{
return $this->URL;
}
public function setURL(?string $URL): self
{
$this->URL = $URL;
return $this;
}
public function getSoundcloud(): ?string
{
return $this->soundcloud;
}
public function setSoundcloud(?string $soundcloud): self
{
$this->soundcloud = $soundcloud;
return $this;
}
public function getUpdatedBy(): ?Users
{
return $this->updatedBy;
}
public function setUpdatedBy(?Users $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getBanner(): ?Picture
{
return $this->banner;
}
public function setBanner(?Picture $banner): self
{
if($banner->getTarget()){
$this->banner = $banner;
$this->banner->setDir('upload/images/articles/');
$this->banner->setThumbnailDir('upload/thumbnails/articles/');
}
return $this;
}
public function getCategory(): ?ArticlesCategories
{
return $this->category;
}
public function setCategory(?ArticlesCategories $category): self
{
$this->category = $category;
return $this;
}
public function getUser(): ?Users
{
return $this->user;
}
public function setUser(?Users $user): self
{
$this->user = $user;
return $this;
}
public function getAlbum(): ?Albums
{
return $this->album;
}
public function setAlbum(?Albums $album): self
{
$this->album = $album;
return $this;
}
public function getBiblio(): ?Biblios
{
return $this->biblio;
}
public function setBiblio(?Biblios $biblio): self
{
$this->biblio = $biblio;
return $this;
}
public function getType(): ?ArticlesTypes
{
return $this->type;
}
public function setType(?ArticlesTypes $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection|Tags[]
*/
public function getTags(): Collection
{
return $this->tags;
}
public function addTag(Tags $tag): self
{
if (!$this->tags->contains($tag)) {
$this->tags[] = $tag;
}
return $this;
}
public function removeTag(Tags $tag): self
{
$this->tags->removeElement($tag);
return $this;
}
}