src/Entity/BlogPost.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogPostRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass: BlogPostRepository::class)]
  7. class BlogPost
  8. {
  9. #[ORM\Id]
  10. #[ORM\GeneratedValue]
  11. #[ORM\Column]
  12. private ?int $id = null;
  13. #[ORM\Column(length: 255)]
  14. private ?string $title = null;
  15. #[ORM\Column(length: 255, unique: true)]
  16. private ?string $slug = null;
  17. #[ORM\Column(type: Types::TEXT)]
  18. private ?string $summary = null;
  19. #[ORM\Column(type: Types::TEXT)]
  20. private ?string $content = null;
  21. #[ORM\Column]
  22. private ?\DateTimeImmutable $createdAt = null;
  23. public function __construct()
  24. {
  25. $this->createdAt = new \DateTimeImmutable();
  26. }
  27. public function getId(): ?int
  28. {
  29. return $this->id;
  30. }
  31. public function getTitle(): ?string
  32. {
  33. return $this->title;
  34. }
  35. public function setTitle(string $title): static
  36. {
  37. $this->title = $title;
  38. return $this;
  39. }
  40. public function getSlug(): ?string
  41. {
  42. return $this->slug;
  43. }
  44. public function setSlug(string $slug): static
  45. {
  46. $this->slug = $slug;
  47. return $this;
  48. }
  49. public function getSummary(): ?string
  50. {
  51. return $this->summary;
  52. }
  53. public function setSummary(string $summary): static
  54. {
  55. $this->summary = $summary;
  56. return $this;
  57. }
  58. public function getContent(): ?string
  59. {
  60. return $this->content;
  61. }
  62. public function setContent(string $content): static
  63. {
  64. $this->content = $content;
  65. return $this;
  66. }
  67. public function getCreatedAt(): ?\DateTimeImmutable
  68. {
  69. return $this->createdAt;
  70. }
  71. public function setCreatedAt(\DateTimeImmutable $createdAt): static
  72. {
  73. $this->createdAt = $createdAt;
  74. return $this;
  75. }
  76. }