<?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\Validator;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Repository\ActualitecabinetRepository;
/**
* Actualitecabinet
*
* @Vich\Uploadable
*/
#[ORM\Table(name: 'actualiteCabinet')]
#[ORM\Entity(repositoryClass: ActualitecabinetRepository::class)]
class Actualitecabinet
{
/**
* @var int
*
*/
#[ORM\Column(name: 'id', type: 'bigint', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
/**
* @var string
*
*/
#[ORM\Column(name: 'titre', type: 'string', length: 255, nullable: false)]
#[Assert\NotBlank]
private $titre;
/**
* @Gedmo\Slug(fields={"titre"})
*/
#[ORM\Column(nullable: true)]
private $slug;
/**
* @var string
*
*/
#[ORM\Column(name: 'descriptifTexte', type: 'text', nullable: false)]
private $descriptifTexte;
/**
* @var string
*
*/
#[ORM\Column(name: 'descriptifRTF', type: 'text', nullable: false)]
#[Assert\NotBlank]
private $descriptifrtf;
/**
* @var \DateTime
*
*/
#[ORM\Column(name: 'dateActualite', type: 'date', nullable: false)]
private $dateactualite;
/**
* @var AccountingFirm
*
*/
#[ORM\JoinColumn(name: 'FK_cabinet', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: 'AccountingFirm', inversedBy: 'actualitecabinets')]
private $accountingFirm;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $file = null;
#[ORM\Column(type: 'datetime', length: 255, nullable: true)]
private $updatedAt = null;
/**
* @Vich\UploadableField(mapping="documents", fileNameProperty="file")
* @var File|null
*/
private $tmpFile = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $photo = null;
/**
* @Vich\UploadableField(mapping="photos", fileNameProperty="photo")
* @var File|null
*/
private $tmpPhoto = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $url;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $urlTitle;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $fileTitle;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $youtube;
#[ORM\Column(type: 'string', length: 2, nullable: true)]
#[Assert\NotNull]
private $month;
#[ORM\Column(type: 'string', length: 4)]
#[Assert\NotNull]
private $year;
/**
* @return int
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string
*/
public function getTitre(): ?string
{
return $this->titre;
}
/**
* @param string $titre
* @return Actualitecabinet
*/
public function setTitre(string $titre): Actualitecabinet
{
$this->titre = $titre;
return $this;
}
/**
* @return string
*/
public function getDescriptiftexte(): string
{
return $this->descriptifTexte;
}
/**
* @param string $descriptifTexte
* @return Actualitecabinet
*/
public function setDescriptiftexte(string $descriptifTexte): Actualitecabinet
{
$this->descriptifTexte = $descriptifTexte;
return $this;
}
/**
* @return string
*/
public function getDescriptifrtf(): string
{
return $this->descriptifrtf;
}
/**
* @param string $descriptifrtf
* @return Actualitecabinet
*/
public function setDescriptifrtf(?string $descriptifrtf): Actualitecabinet
{
$this->descriptifrtf = $descriptifrtf;
$this->descriptifTexte = strip_tags($descriptifrtf);
return $this;
}
/**
* @return \DateTime
*/
public function getDateactualite(): ?\DateTime
{
return $this->dateactualite;
}
/**
* @param \DateTime $dateactualite
* @return Actualitecabinet
*/
public function setDateactualite(\DateTime $dateactualite): Actualitecabinet
{
$this->dateactualite = $dateactualite;
return $this;
}
/**
* @return AccountingFirm
*/
public function getAccountingFirm(): ?AccountingFirm
{
return $this->accountingFirm;
}
/**
* @param AccountingFirm $accountingFirm
* @return Actualitecabinet
*/
public function setAccountingFirm(?AccountingFirm $accountingFirm): Actualitecabinet
{
$this->accountingFirm = $accountingFirm;
return $this;
}
public function getFile(): ?string
{
return $this->file;
}
public function setFile(?string $file): self
{
$this->file = $file;
return $this;
}
public function setTmpFile(?File $tmpFile = null): void
{
$this->tmpFile = $tmpFile;
$this->updatedAt = new \DateTime('now');
}
public function getTmpFile() : ?File
{
return $this->tmpFile;
}
public function setTmpPhoto(?File $tmpPhoto = null): void
{
$this->tmpPhoto = $tmpPhoto;
$this->updatedAt = new \DateTime('now');
}
public function getTmpPhoto() : ?File
{
return $this->tmpPhoto;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): self
{
$this->photo = $photo;
return $this;
}
/**
* @return null
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param null $updatedAt
* @return Actualitecabinet
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getUrlTitle(): ?string
{
return $this->urlTitle;
}
public function setUrlTitle(?string $urlTitle): self
{
$this->urlTitle = $urlTitle;
return $this;
}
public function getFileTitle(): ?string
{
return $this->fileTitle;
}
public function setFileTitle(?string $fileTitle): self
{
$this->fileTitle = $fileTitle;
return $this;
}
public function getYoutube(): ?string
{
return $this->youtube;
}
public function setYoutube(?string $youtube): self
{
$this->youtube = $youtube;
return $this;
}
public function getMonth(): ?string
{
if (null === $this->month && $this->getDateactualite()) {
$this->month = $this->getDateactualite()->format('m');
}
return $this->month;
}
public function setMonth(?string $month): self
{
$this->month = $month;
if ($this->year && $this->month) {
$this->setDateactualite(
new \DateTime($this->year . '-' . $this->month . '-01 12:00:00')
);
}
return $this;
}
public function getYear(): ?string
{
if (null === $this->year && $this->getDateactualite()) {
$this->year = $this->getDateactualite()->format('Y');
}
return $this->year;
}
public function setYear(string $year): self
{
$this->year = $year;
if ($this->year && $this->month) {
$this->setDateactualite(
new \DateTime($this->year . '-' . $this->month . '-01 12:00:00')
);
}
return $this;
}
public function getSlug()
{
return $this->slug;
}
}