<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Serializer\Annotation\Ignore;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Notification
*
* @ORM\Table(name="notification")
* @ORM\Entity(repositoryClass="App\Repository\NotificationRepository")
*/
class Notification
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private int $id;
/**
* @ORM\Column(name="reception_date", type="datetime", nullable=false)
*/
private DateTime $receptionDate;
/**
* @ORM\Column(name="created_at", type="datetime")
*/
private DateTime $createdAt;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Building", cascade={"persist"})
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="building_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* })
*/
private Building $building;
/**
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private string|null $title;
/**
* @ORM\Column(name="text", type="string", length=512, nullable=true)
*/
private string|null $text;
/**
* @ORM\Column(name="status", type="integer", nullable=true)
*/
private int|null $status;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
* })
*/
#[Ignore]
private User $user;
/**
* @ORM\Column(name="createdBy", type="string", nullable=true)
*/
private string|null $createdBy;
/**
* @ORM\Column(name="publish_notification", type="boolean")
*/
private bool $publish_notification = false;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\File(mimeTypes={ "application/pdf" })
*/
private UploadedFile|File|string|null $file = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $fileName = null;
/**
* @return string|null
*/
public function getCreatedBy(): ?string
{
return $this->createdBy;
}
/**
* @param string $createdBy
*/
public function setCreatedBy(string $createdBy): void
{
$this->createdBy = $createdBy;
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return DateTime
*/
public function getReceptionDate(): DateTime
{
return $this->receptionDate;
}
/**
* @param DateTime $receptionDate
*/
public function setReceptionDate(DateTime $receptionDate): void
{
$this->receptionDate = $receptionDate;
}
/**
* @return DateTime
*/
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
/**
* @param DateTime $createdAt
*/
public function setCreatedAt(DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* @return Building
*/
public function getBuilding(): Building
{
return $this->building;
}
/**
* @param Building $building
*/
public function setBuilding(Building $building): void
{
$this->building = $building;
}
/**
* @return string|null
*/
public function getTitle(): ?string
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle(string $title): void
{
$this->title = $title;
}
/**
* @return string|null
*/
public function getText(): ?string
{
return $this->text;
}
/**
* @param string $text
*/
public function setText(string $text): void
{
$this->text = $text;
}
/**
* @return int|null
*/
public function getStatus(): ?int
{
return $this->status;
}
/**
* @param int $status
*/
public function setStatus(int $status): void
{
$this->status = $status;
}
/**
* @return User
*/
#[Ignore]
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
*/
#[Ignore]
public function setUser(User $user): void
{
$this->user = $user;
if (empty($this->createdBy)) {
$this->createdBy = $user->getCreatedByValue();
}
}
/**
* @return bool
*/
public function isPublishNotification(): bool
{
return $this->publish_notification;
}
/**
* @param bool $publish_notification
*/
public function setPublishNotification(bool $publish_notification): void
{
$this->publish_notification = $publish_notification;
}
public function getFile(): File|string|UploadedFile|null
{
return $this->file;
}
public function setFile(File|string|UploadedFile|null $file): void
{
$this->file = $file;
}
public function getFileName(): ?string
{
return $this->fileName;
}
public function setFileName(?string $fileName): void
{
$this->fileName = $fileName;
}
}