Skip to content

Commit

Permalink
Merge pull request #632 from hydephp/remove-deprecated-ConstructsPage…
Browse files Browse the repository at this point in the history
…Schemas-trait

Remove ConstructsPageSchemas schemas trait
  • Loading branch information
caendesilva authored Oct 30, 2022
2 parents a9d97f6 + ce31f12 commit 6b5859b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 36 deletions.

This file was deleted.

18 changes: 18 additions & 0 deletions packages/framework/src/Framework/Factories/Concerns/HasFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace Hyde\Framework\Factories\Concerns;

use Hyde\Framework\Factories\BlogPostDataFactory;
use Hyde\Framework\Factories\HydePageDataFactory;
use Hyde\Pages\MarkdownPost;

trait HasFactory
{
public function constructFactoryData(PageDataFactory $data): void
Expand All @@ -12,4 +16,18 @@ public function constructFactoryData(PageDataFactory $data): void
$this->{$key} = $value;
}
}

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

if ($this instanceof MarkdownPost) {
$this->constructFactoryData(new BlogPostDataFactory($this->matter, $this->markdown));
}
}

protected function constructPageSchema(): void
{
$this->constructFactoryData(new HydePageDataFactory($this->matter, $this->markdown ?? false, $this::class, $this->identifier, $this->getOutputPath(), $this->routeKey));
}
}
2 changes: 0 additions & 2 deletions packages/framework/src/Pages/Concerns/HydePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Hyde\Foundation\PageCollection;
use Hyde\Framework\Actions\SourceFileParser;
use Hyde\Framework\Concerns\InteractsWithFrontMatter;
use Hyde\Framework\Concerns\Internal\ConstructsPageSchemas;
use Hyde\Framework\Factories\Concerns\HasFactory;
use Hyde\Framework\Features\Metadata\PageMetadataBag;
use Hyde\Framework\Features\Navigation\NavigationData;
Expand Down Expand Up @@ -37,7 +36,6 @@
*/
abstract class HydePage implements PageSchema
{
use ConstructsPageSchemas;
use InteractsWithFrontMatter;
use HasFactory;

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Feature/HydePageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @covers \Hyde\Pages\Concerns\HydePage
* @covers \Hyde\Pages\Concerns\BaseMarkdownPage
* @covers \Hyde\Framework\Concerns\Internal\ConstructsPageSchemas
* @covers \Hyde\Framework\Factories\Concerns\HasFactory
* @covers \Hyde\Framework\Factories\NavigationDataFactory
* @covers \Hyde\Framework\Factories\FeaturedImageFactory
* @covers \Hyde\Framework\Factories\HydePageDataFactory
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Feature/MarkdownPostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* @covers \Hyde\Pages\MarkdownPost
* @covers \Hyde\Framework\Concerns\Internal\ConstructsPageSchemas
* @covers \Hyde\Framework\Factories\Concerns\HasFactory
*/
class MarkdownPostTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Test the constructor actions and schema constructors for page models.
*
* @covers \Hyde\Framework\Concerns\Internal\ConstructsPageSchemas
* @covers \Hyde\Framework\Factories\Concerns\HasFactory
* @covers \Hyde\Framework\Factories\NavigationDataFactory
* @covers \Hyde\Framework\Factories\FeaturedImageFactory
* @covers \Hyde\Framework\Factories\HydePageDataFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* @covers \Hyde\Framework\Features\Navigation\DocumentationSidebar
* @covers \Hyde\Framework\Concerns\Internal\ConstructsPageSchemas
* @covers \Hyde\Framework\Factories\Concerns\HasFactory
* @covers \Hyde\Framework\Factories\NavigationDataFactory
*/
class DocumentationSidebarTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/DocumentationPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* @covers \Hyde\Pages\DocumentationPage
* @covers \Hyde\Framework\Concerns\Internal\ConstructsPageSchemas
* @covers \Hyde\Framework\Factories\Concerns\HasFactory
* @covers \Hyde\Framework\Factories\NavigationDataFactory
*/
class DocumentationPageTest extends TestCase
Expand Down

0 comments on commit 6b5859b

Please sign in to comment.