Skip to content

Commit

Permalink
fix baserproject#3634[要望]BlogControllerにイベント beforeQueryParamsを追加したい要…
Browse files Browse the repository at this point in the history
…望を解決
  • Loading branch information
kato committed Jul 26, 2024
1 parent 0f53330 commit a1f0dee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/bc-blog/src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function index(
'sort' => 'BlogPosts.posted',
'direction' => $blogContent->list_direction
], $this->getRequest()->getQueryParams())));
$entities = $this->paginate($blogPostsService->getIndex([
$queryParams = [
'blog_content_id' => $blogContentId,
'limit' => $listCount,
'status' => 'publish',
Expand All @@ -120,7 +120,14 @@ public function index(
'BlogContents' => ['Contents'],
'BlogComments',
'BlogTags',
]]));
]];

// EVENT Blog.beforeQueryParams
$event = $this->dispatchLayerEvent('beforeQueryParams', [
'data' => $queryParams
]);

$entities = $this->paginate($blogPostsService->getIndex($queryParams));
} catch (NotFoundException $e) {
return $this->redirect(['action' => 'index']);
}
Expand Down

0 comments on commit a1f0dee

Please sign in to comment.