src/Entity/Post.php line 16
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\PostRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: PostRepository::class)]
#[ApiResource]
#[Vich\Uploadable]
class Post
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[Vich\UploadableField(mapping: "post_image", fileNameProperty: "image")]
private ?File $imageFile = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $datePosting = null;
public function __construct()
{
$this->datePosting = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): static
{
$this->image = $image;
return $this;
}
public function getDatePosting(): ?\DateTimeInterface
{
return $this->datePosting;
}
public function setDatePosting(\DateTimeInterface $datePosting): static
{
$this->datePosting = $datePosting;
return $this;
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageFile(?File $imageFile): void
{
$this->imageFile = $imageFile;
}
}