diff --git a/migrations/Version20250522212213.php b/migrations/Version20250522212213.php new file mode 100644 index 0000000..0612173 --- /dev/null +++ b/migrations/Version20250522212213.php @@ -0,0 +1,35 @@ +addSql(<<<'SQL' + CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, slug VARCHAR(255) NOT NULL, published_date DATE NOT NULL, updated_date DATE DEFAULT NULL, content CLOB NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(1024) NOT NULL) + SQL); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql(<<<'SQL' + DROP TABLE blog_post + SQL); + } +} diff --git a/migrations/Version20250522212300.php b/migrations/Version20250522212300.php new file mode 100644 index 0000000..ec69856 --- /dev/null +++ b/migrations/Version20250522212300.php @@ -0,0 +1,63 @@ +addSql(<<addSql(<<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; + } +} diff --git a/src/Repository/BlogPostRepository.php b/src/Repository/BlogPostRepository.php new file mode 100644 index 0000000..381e16e --- /dev/null +++ b/src/Repository/BlogPostRepository.php @@ -0,0 +1,17 @@ + + */ +class BlogPostRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) { + parent::__construct($registry, BlogPost::class); + } +} diff --git a/todo.txt b/todo.txt index 7639ea2..20d2a30 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,6 @@ Tidy up notes index page to match existing links index page -Make BlogPost entity Add blog post page Add blog index page -Write an SQL script to insert all blog posts from existing website Add a most recent blog post to my home page Add a most recent note to my home page Write a script to take a database dump