src/Entity/Article.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ArticleRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassArticleRepository::class)]
  8. #[ApiResource]
  9. class Article
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length65uniquetrue)]
  16.     private ?string $title null;
  17.     #[ORM\Column(length65uniquetrue)]
  18.     private ?string $slug null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\ManyToOne(inversedBy'articles'fetch'EAGER')]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private ?Category $category null;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $content null;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getTitle(): ?string
  31.     {
  32.         return $this->title;
  33.     }
  34.     public function setTitle(string $title): self
  35.     {
  36.         $this->title $title;
  37.         return $this;
  38.     }
  39.     public function getSlug(): ?string
  40.     {
  41.         return $this->slug;
  42.     }
  43.     public function setSlug(string $slug): self
  44.     {
  45.         $this->slug $slug;
  46.         return $this;
  47.     }
  48.     public function getDescription(): ?string
  49.     {
  50.         return $this->description;
  51.     }
  52.     public function setDescription(?string $description): self
  53.     {
  54.         $this->description $description;
  55.         return $this;
  56.     }
  57.     public function getCategory(): ?Category
  58.     {
  59.         return $this->category;
  60.     }
  61.     public function setCategory(?Category $category): self
  62.     {
  63.         $this->category $category;
  64.         return $this;
  65.     }
  66.     public function getContent(): ?string
  67.     {
  68.         return $this->content;
  69.     }
  70.     public function setContent(?string $content): self
  71.     {
  72.         $this->content $content;
  73.         return $this;
  74.     }
  75. }