Skip to content

Commit

Permalink
Update Seo class references to use interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Dec 5, 2023
1 parent 41f1e82 commit fd054a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Domain/Category/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getPost(): ActiveQuery

public function getSeo(): ActiveQuery
{
return $this->hasOne(Seo::class, ['item_id' => 'id'])->andWhere(['class' => self::class]);
return $this->hasOne(Seo::class, ['item_id' => 'id'])->andWhere(['class' => CategoryInterface::class]);
}

public function scenarios(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getCategory(): ActiveQuery

public function getSeo(): ActiveQuery
{
return $this->hasOne(Seo::class, ['item_id' => 'id'])->andWhere(['class' => self::class]);
return $this->hasOne(Seo::class, ['item_id' => 'id'])->andWhere(['class' => PostInterface::class]);
}

public function scenarios(): array
Expand Down
6 changes: 3 additions & 3 deletions src/UseCase/Category/Register/RegisterAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use yii\base\Action;
use yii\base\ExitException;
use Yii\Blog\BlogModule;
use Yii\Blog\Domain\Category\Category;
use Yii\Blog\Domain\Category\CategoryInterface;
use Yii\Blog\Domain\Seo\SeoInterface;
use Yii\Blog\UseCase\Category\CategoryEvent;
use Yii\Blog\UseCase\Category\CategoryService;
Expand All @@ -26,7 +26,7 @@ public function __construct(
Controller $controller,
private readonly AjaxValidator $ajaxValidator,
private readonly BlogModule $blogModule,
private readonly Category $category,
private readonly CategoryInterface $category,
private readonly CategoryService $categoryService,
private readonly RegisterService $registerService,
private readonly Request $request,
Expand Down Expand Up @@ -56,7 +56,7 @@ public function run(string $id = null): string|Response
$categoryForm->validate() &&
$seoForm->validate() &&
$this->registerService->run($this->category, $categoryForm, $id) &&
$this->seoService->run($this->seo, $seoForm, Category::class, $categoryForm->id)
$this->seoService->run($this->seo, $seoForm, CategoryInterface::class, $categoryForm->id)
) {
$this->trigger(CategoryEvent::AFTER_REGISTER, $registerEvent);

Expand Down

0 comments on commit fd054a8

Please sign in to comment.