Skip to content

Commit

Permalink
Merge pull request #368 from hydephp/fix-premature-access-call-bug
Browse files Browse the repository at this point in the history
Create method to construct schemas to control the call order
  • Loading branch information
caendesilva authored Aug 7, 2022
2 parents c4a5b04 + e1566ef commit 3b0e835
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 3b0e835

Please sign in to comment.