<?php
namespace App\Entity;
use App\Repository\WebsiteNewsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: WebsiteNewsRepository::class)]
class WebsiteNews
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: AccountingFirm::class, inversedBy: 'websiteNews')]
#[ORM\JoinColumn(nullable: false)]
private $accountingFirm;
#[ORM\Column(type: 'string', length: 255)]
#[Assert\NotBlank]
private $title;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $seoTitle;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $seoDescription;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $optimizedLink;
#[ORM\Column(type: 'text')]
private $description;
#[ORM\OneToMany(targetEntity: Image::class, mappedBy: 'websiteNews', cascade: ['all'])]
private $images;
#[ORM\OneToMany(targetEntity: Document::class, mappedBy: 'websiteNews', cascade: ['all'])]
private $documents;
#[ORM\OneToMany(targetEntity: Link::class, mappedBy: 'websiteNews', cascade: ['all'])]
private $links;
/**
* @Gedmo\Slug(fields={"title"})
*/
#[ORM\Column(nullable: true)]
private $slug;
#[ORM\Column(type: 'datetime', nullable: true)]
private $dateadd;
public function __construct()
{
$this->images = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->links = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getAccountingFirm(): ?AccountingFirm
{
return $this->accountingFirm;
}
public function setAccountingFirm(?AccountingFirm $accountingFirm): self
{
$this->accountingFirm = $accountingFirm;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getSeoTitle(): ?string
{
return $this->seoTitle;
}
public function setSeoTitle(?string $seoTitle): self
{
$this->seoTitle = $seoTitle;
return $this;
}
public function getSeoDescription(): ?string
{
return $this->seoDescription;
}
public function setSeoDescription(?string $seoDescription): self
{
$this->seoDescription = $seoDescription;
return $this;
}
public function getOptimizedLink(): ?string
{
return $this->optimizedLink;
}
public function setOptimizedLink(?string $optimizedLink): self
{
$this->optimizedLink = $optimizedLink;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection|Image[]
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): self
{
if (!$this->images->contains($image)) {
$this->images[] = $image;
$image->setWebsiteNews($this);
}
return $this;
}
public function removeImage(Image $image): self
{
dump($image);
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getWebsiteNews() === $this) {
$image->setWebsiteNews(null);
}
}
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setWebsiteNews($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getWebsiteNews() === $this) {
$document->setWebsiteNews(null);
}
}
return $this;
}
/**
* @return Collection|Url[]
*/
public function getLinks(): Collection
{
return $this->links;
}
public function addLink(Link $link): self
{
if (!$this->links->contains($link)) {
$this->links[] = $link;
$link->setWebsiteNews($this);
}
return $this;
}
public function removeLink(Link $link): self
{
if ($this->links->removeElement($link)) {
// set the owning side to null (unless already changed)
if ($link->getWebsiteNews() === $this) {
$link->setWebsiteNews(null);
}
}
return $this;
}
public function getSlug()
{
return $this->slug;
}
public function getDateadd(): ?\DateTimeInterface
{
return $this->dateadd;
}
public function setDateadd(?\DateTimeInterface $dateadd): self
{
$this->dateadd = $dateadd;
return $this;
}
}