Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baserCMS 5系 blogPosts()でカテゴリの指定を行うとエラーになる問題 #2991

Closed
katokaisya opened this issue Dec 26, 2023 · 0 comments

Comments

@katokaisya
Copy link
Collaborator

baserCMS 5系
blogPosts()でカテゴリの指定を行うと
$this->BcBaser->blogPosts('news', 6, ['category' => 'media'])
表示側で
BcBlog\Service\BlogPostsService::createCategoryCondition(): Argument #4 ($contentUrl) must be of type ?string, array given, called in /var/www/html/plugins/bc-blog/src/Service/BlogPostsService.php on line 311
となってしまいます。
こちら、
/plugins/bc-blog/src/Service/BlogPostsService.php
$params['contentUrl'],がarray型で入っているのにも関わらず、

createCategoryCondition(
        array $conditions,
        string $category,
        int $blogContentId = null,
        string $contentUrl = null,
        bool $force = false)

にてstring型が指定されているために発生しているようです。
(contentUrlがarray型になっているのはBlogHelperのparseContentName()にて複数のブログも使用可能になっているのが、原因のようです。)
こちら、
/plugins/bc-blog/src/Service/BlogPostsService.php
にて、
・型指定の部分を修正
・$categoryConditions['BlogCategories.blog_content_id'] の取得をループに変えておく
といった改修を加えたほうが良いでしょうか

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant