Skip to content

Commit

Permalink
Create method to construct schemas to control the call order
Browse files Browse the repository at this point in the history
This was cause to a weird issue where some data was not present in some places. This is of course because the data had not been constructed yet. As long as each child that has a schema adds it to the new construct method (and calls the parent) this issue should be fixed.
  • Loading branch information
caendesilva committed Aug 7, 2022
1 parent c4a5b04 commit e1566ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/framework/src/Contracts/AbstractPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public function __construct(string $identifier = '', FrontMatter|array $matter =
{
$this->identifier = $identifier;
$this->matter = $matter instanceof FrontMatter ? $matter : new FrontMatter($matter);
$this->constructPageSchemas();
}

protected function constructPageSchemas(): void
{
$this->constructPageSchema();
}

Expand Down
6 changes: 5 additions & 1 deletion packages/framework/src/Models/Pages/MarkdownPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ class MarkdownPost extends AbstractMarkdownPage
public function __construct(string $identifier = '', ?FrontMatter $matter = null, ?Markdown $markdown = null)
{
parent::__construct($identifier, $matter, $markdown);
$this->constructMetadata();
}

protected function constructPageSchemas(): void
{
parent::constructPageSchemas();
$this->constructBlogPostSchema();
$this->constructMetadata();
}

/** @deprecated v0.58.x-beta (may be moved to BlogPostSchema) */
Expand Down

0 comments on commit e1566ef

Please sign in to comment.