src/Entity/Revision.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RevisionRepository;
  4. use DateTimeInterface;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassRevisionRepository::class)]
  9. class Revision
  10. {
  11.     public const PENDING 0;
  12.     public const ACCEPTED 1;
  13.     public const REJECTED = -1;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?User $author null;
  21.     #[ORM\Column(typeTypes::TEXT)]
  22.     #[Assert\NotBlank]
  23.     private ?string $content null;
  24.     #[ORM\Column(length1options: ["default" => 0])]
  25.     private ?int $status self::PENDING;
  26.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  27.     private ?DateTimeInterface $createdAt null;
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getAuthor(): ?User
  33.     {
  34.         return $this->author;
  35.     }
  36.     public function setAuthor(?User $author): self
  37.     {
  38.         $this->author $author;
  39.         return $this;
  40.     }
  41.     public function getContent(): ?string
  42.     {
  43.         return $this->content;
  44.     }
  45.     public function setContent(string $content): self
  46.     {
  47.         $this->content $content;
  48.         return $this;
  49.     }
  50.     public function getStatus(): ?int
  51.     {
  52.         return $this->status;
  53.     }
  54.     public function setStatus(int $status): self
  55.     {
  56.         $this->status $status;
  57.         return $this;
  58.     }
  59.     public function getCreatedAt(): ?DateTimeInterface
  60.     {
  61.         return $this->createdAt;
  62.     }
  63.     public function setCreatedAt(DateTimeInterface $createdAt): self
  64.     {
  65.         $this->createdAt $createdAt;
  66.         return $this;
  67.     }
  68. }