150 lines
3.0 KiB
PHP
150 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Entity\Project;
|
|
|
|
use App\Entity\DateCreatedTrait;
|
|
use App\Entity\DateUpdatedTrait;
|
|
use App\Entity\LocalizedInterface;
|
|
use App\Entity\LocalizedTrait;
|
|
use App\Entity\User\User;
|
|
use App\Mapping\Provider\EntityMapProvider;
|
|
use App\Repository\Project\UpdateRepository;
|
|
use AutoMapper\Attribute\MapProvider;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Gedmo\Mapping\Annotation as Gedmo;
|
|
|
|
#[MapProvider(EntityMapProvider::class)]
|
|
#[ORM\Table(name: 'project_update')]
|
|
#[ORM\Entity(repositoryClass: UpdateRepository::class)]
|
|
class Update implements LocalizedInterface
|
|
{
|
|
use LocalizedTrait;
|
|
use DateCreatedTrait;
|
|
use DateUpdatedTrait;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'updates')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Project $project = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Gedmo\Translatable()]
|
|
private ?string $title = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Gedmo\Translatable()]
|
|
private ?string $subtitle = null;
|
|
|
|
#[ORM\Column(type: Types::TEXT)]
|
|
#[Gedmo\Translatable()]
|
|
private ?string $body = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
|
private ?\DateTimeInterface $date = null;
|
|
|
|
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
|
private ?string $cover = null;
|
|
|
|
#[ORM\ManyToOne]
|
|
private ?User $author = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->date = $this->date ?? new \DateTime();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getProject(): ?Project
|
|
{
|
|
return $this->project;
|
|
}
|
|
|
|
public function setProject(?Project $project): static
|
|
{
|
|
$this->project = $project;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSubtitle(): ?string
|
|
{
|
|
return $this->subtitle;
|
|
}
|
|
|
|
public function setSubtitle(string $subtitle): static
|
|
{
|
|
$this->subtitle = $subtitle;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getBody(): ?string
|
|
{
|
|
return $this->body;
|
|
}
|
|
|
|
public function setBody(string $body): static
|
|
{
|
|
$this->body = $body;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDate(): ?\DateTimeInterface
|
|
{
|
|
return $this->date;
|
|
}
|
|
|
|
public function setDate(\DateTimeInterface $date): static
|
|
{
|
|
$this->date = $date;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCover(): ?string
|
|
{
|
|
return $this->cover;
|
|
}
|
|
|
|
public function setCover(?string $cover): static
|
|
{
|
|
$this->cover = $cover;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAuthor(): ?User
|
|
{
|
|
return $this->author;
|
|
}
|
|
|
|
public function setAuthor(?User $author): static
|
|
{
|
|
$this->author = $author;
|
|
|
|
return $this;
|
|
}
|
|
}
|