add blog posts to database

This commit is contained in:
2025-05-22 22:50:07 +01:00
parent 8e42c6c3bc
commit 4ad17f126b
5 changed files with 207 additions and 2 deletions

92
src/Entity/BlogPost.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
namespace App\Entity;
use App\Repository\BlogPostRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BlogPostRepository::class)]
class BlogPost
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $slug = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTime $publishedDate = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $updatedDate = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $content = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(length: 1024)]
private ?string $description = null;
public function getId(): ?int {
return $this->id;
}
public function getSlug(): ?string {
return $this->slug;
}
public function setSlug(string $slug): static {
$this->slug = $slug;
return $this;
}
public function getPublishedDate(): ?\DateTime {
return $this->publishedDate;
}
public function setPublishedDate(\DateTime $publishedDate): static {
$this->publishedDate = $publishedDate;
return $this;
}
public function getUpdatedDate(): ?\DateTime {
return $this->updatedDate;
}
public function setUpdatedDate(?\DateTime $updatedDate): static {
$this->updatedDate = $updatedDate;
return $this;
}
public function getContent(): ?string {
return $this->content;
}
public function setContent(string $content): static {
$this->content = $content;
return $this;
}
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;
}
}