Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.rec-app.app_1716798588
/
htdocs
/
src
/
Entity
/
/srv/data/trash/vhost_www.rec-app.app_1716798588/htdocs/src/Entity/News.php
<?php namespace App\Entity; use App\Repository\NewsRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\String\Slugger\SluggerInterface; use Vich\UploaderBundle\Mapping\Annotation as Vich; use ApiPlatform\Core\Annotation\ApiResource; use Symfony\Component\Serializer\Annotation\Groups; /** * @ApiResource( * normalizationContext={"groups"={"news:read"}}, * denormalizationContext={"groups"={"news:write"}} * ) * @ORM\Entity(repositoryClass=NewsRepository::class) * @UniqueEntity(fields={"slug"}, message="This slug is already in use.") * @Vich\Uploadable */ class News { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups("news:read") */ private $id; /** * @ORM\Column(type="string", length=255) * @Groups({"news:read", "news:write"}) */ private $title; /** * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"news:read", "news:write"}) */ private $shortDescription; /** * @Vich\UploadableField(mapping="news_image", fileNameProperty="imageName") * @var File|null * @Groups({"news:read", "news:write"}) */ private $imageFile; /** * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"news:read", "news:write"}) */ private $imageName; /** * @ORM\Column(type="text") * @Groups({"news:read", "news:write"}) */ private $content; /** * @ORM\Column(type="string", length=255, unique=true) * @Groups({"news:read", "news:write"}) */ private $slug; /** * @ORM\Column(type="datetime") * @Groups({"news:read", "news:write"}) */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) * @Groups({"news:read", "news:write"}) */ private $updatedAt; 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 getShortDescription(): ?string { return $this->shortDescription; } public function setShortDescription(string $shortDescription): self { $this->shortDescription = $shortDescription; return $this; } public function getImageFile(): ?File { return $this->imageFile; } public function setImageFile(?File $imageFile = null): void { $this->imageFile = $imageFile; if (null !== $imageFile) { $this->updatedAt = new \DateTimeImmutable(); } } public function getImageName(): ?string { return $this->imageName; } public function setImageName(?string $imageName): self { $this->imageName = $imageName; 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 $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } }