baserCMS クラスリファレンス

BlogPostsService
in package
implements BlogPostsServiceInterface Uses BcContainerTrait

BlogPostsService

Table of Contents

Interfaces

BlogPostsServiceInterface
BlogPostsServiceInterface

Properties

$BlogPosts  : BlogPostsTable
$BlogPosts  : BlogPostsTable|Table
BlogPostsTable

Methods

__construct()  : mixed
Constructor
allowPublish()  : bool
公開状態を取得する
batch()  : bool
一括処理
copy()  : false|mixed
ブログ記事をコピーする
create()  : EntityInterface
新規登録
createAuthorCondition()  : array<string|int, mixed>
作成者の条件を作成する
createCategoryCondition()  : array<string|int, mixed>
カテゴリ条件を生成する
createKeywordCondition()  : array<string|int, mixed>
キーワード条件を生成する
createOrder()  : string
並び替え設定を生成する
createTagCondition()  : QueryInterface
タグ条件を生成する
createYearMonthDayCondition()  : array<string|int, mixed>
年月日条件を生成する
delete()  : bool
ブログ記事を削除する
get()  : EntityInterface
単一データを取得する
getControlSource()  : array<string|int, mixed>|false
コントロールソースを取得する
getIndex()  : Query
ブログ記事一覧を取得する
getIndexByAuthor()  : Query
著者別記事一覧を取得
getIndexByCategory()  : Query
カテゴリ別記事一覧を取得
getIndexByDate()  : Query
日付別記事一覧を取得
getIndexByTag()  : Query
タグ別記事一覧を取得
getNew()  : EntityInterface
初期データ用のエンティティを取得
getNextPost()  : BlogPost|EntityInterface|null
次の記事を取得する
getPrevPost()  : BlogPost|EntityInterface|null
前の記事を取得する
getRelatedPosts()  : array<string|int, mixed>|Query
関連するブログ記事を取得する
getService()  : array<string|int, mixed>|mixed|object
Get Service
getTitlesById()  : array<string|int, mixed>
IDからタイトルリストを取得する
getUrl()  : string
ブログ記事のURLを取得する
hasService()  : bool
Has Service
publish()  : EntityInterface|false
記事を公開状態に設定する
setupUpload()  : void
BlogPostsTable のファイルアップロードの設定を実施
unpublish()  : EntityInterface|false
記事を非公開状態に設定する
update()  : EntityInterface
ブログ記事を更新する
createIndexConditions()  : Query
ページ一覧用の検索条件を生成する

Properties

Methods

__construct()

Constructor

public __construct() : mixed

BlogPosts テーブルを初期化してセットする

Tags
checked
noTodo
unitTest

allowPublish()

公開状態を取得する

public allowPublish(EntityInterface $post) : bool
Parameters
$post : EntityInterface
Tags
checked
noTodo
unitTest

ラッパーメソッドのためテスト不要

Return values
bool

公開状態

batch()

一括処理

public batch(string $method, array<string|int, mixed> $ids) : bool
Parameters
$method : string
$ids : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
bool

copy()

ブログ記事をコピーする

public copy(int $id) : false|mixed
Parameters
$id : int
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストはスキップする

Return values
false|mixed

create()

新規登録

public create(array<string|int, mixed> $postData) : EntityInterface
Parameters
$postData : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
EntityInterface

createAuthorCondition()

作成者の条件を作成する

public createAuthorCondition(array<string|int, mixed> $conditions, string $author) : array<string|int, mixed>
Parameters
$conditions : array<string|int, mixed>
$author : string
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

createCategoryCondition()

カテゴリ条件を生成する

public createCategoryCondition(array<string|int, mixed> $conditions, string $category[, int $blogContentId = null ][, array<string|int, mixed>|string $contentUrl = null ][, bool $force = false ]) : array<string|int, mixed>
Parameters
$conditions : array<string|int, mixed>
$category : string
$blogContentId : int = null
$contentUrl : array<string|int, mixed>|string = null
$force : bool = false
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

createKeywordCondition()

キーワード条件を生成する

public createKeywordCondition(array<string|int, mixed> $conditions, string $keyword) : array<string|int, mixed>
Parameters
$conditions : array<string|int, mixed>
$keyword : string
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

createOrder()

並び替え設定を生成する

public createOrder(string $sort, string $direction) : string
Parameters
$sort : string
$direction : string
Tags
checked
Return values
string

createTagCondition()

タグ条件を生成する

public createTagCondition(Query $query, mixed $tag) : QueryInterface
Parameters
$query : Query
$tag : mixed

タグ(配列可)

Tags
checked
noTodo
unitTest
Return values
QueryInterface

createYearMonthDayCondition()

年月日条件を生成する

public createYearMonthDayCondition(array<string|int, mixed> $conditions, int $year, int $month, int $day) : array<string|int, mixed>
Parameters
$conditions : array<string|int, mixed>
$year : int
$month : int
$day : int
Tags
checked
unitTest
Return values
array<string|int, mixed>

delete()

ブログ記事を削除する

public delete(int $id) : bool
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
bool

get()

単一データを取得する

public get(int $id[, array<string|int, mixed> $options = [] ]) : EntityInterface
Parameters
$id : int
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
EntityInterface

getControlSource()

コントロールソースを取得する

public getControlSource(string $field[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|false

blog_category_id / user_id / blog_tag_id を対象とする

Parameters
$field : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>|false

getIndex()

ブログ記事一覧を取得する

public getIndex([array<string|int, mixed> $queryParams = [] ]) : Query
Parameters
$queryParams : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
Query

getIndexByAuthor()

著者別記事一覧を取得

public getIndexByAuthor(string $author[, array<string|int, mixed> $options = [] ]) : Query
Parameters
$author : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
Query

getIndexByCategory()

カテゴリ別記事一覧を取得

public getIndexByCategory(string $category[, array<string|int, mixed> $options = [] ]) : Query
Parameters
$category : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
Query

getIndexByDate()

日付別記事一覧を取得

public getIndexByDate(string $year, string $month, string $day[, array<string|int, mixed> $options = [] ]) : Query
Parameters
$year : string
$month : string
$day : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
Query

getIndexByTag()

タグ別記事一覧を取得

public getIndexByTag(string $tag[, array<string|int, mixed> $options = [] ]) : Query
Parameters
$tag : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
Query

getNew()

初期データ用のエンティティを取得

public getNew(int $blogContentId, int $userId) : EntityInterface
Parameters
$blogContentId : int
$userId : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface

getRelatedPosts()

関連するブログ記事を取得する

public getRelatedPosts(BlogPost $post[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|Query
Parameters
$post : BlogPost
$options : array<string|int, mixed> = []
Tags
noTodo
checked
unitTest
Return values
array<string|int, mixed>|Query

getService()

Get Service

public getService( $service) : array<string|int, mixed>|mixed|object
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>|mixed|object

getTitlesById()

IDからタイトルリストを取得する

public getTitlesById(array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
$ids : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

hasService()

Has Service

public hasService( $service) : bool
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
bool

publish()

記事を公開状態に設定する

public publish(int $id) : EntityInterface|false

公開期間指定は初期化する

Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface|false

setupUpload()

BlogPostsTable のファイルアップロードの設定を実施

public setupUpload(int $blogContentId) : void
Parameters
$blogContentId : int
Tags
checked
noTodo
unitTest

ラッパーメソッドのため、ユニットテストは不要

unpublish()

記事を非公開状態に設定する

public unpublish(int $id) : EntityInterface|false

公開期間指定は初期化する

Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface|false

update()

ブログ記事を更新する

public update(EntityInterface|BlogPost $post, array<string|int, mixed> $postData) : EntityInterface

POSTデータのサイズが設定ファイルで定義されたpost_max_sizeを超えた場合は例外処理される

Parameters
$post : EntityInterface|BlogPost
$postData : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
EntityInterface

createIndexConditions()

ページ一覧用の検索条件を生成する

protected createIndexConditions(Query $query, array<string|int, mixed> $params) : Query
Parameters
$query : Query
$params : array<string|int, mixed>
  • title: タイトル
  • user_id: 作成者
  • status: 公開状態。publish もしくは 1 の場合、公開期間も加味する。
  • blog_content_id: ブログコンテンツID
  • blog_tag_id: ブログタグID
  • blog_category_id: ブログカテゴリID
Tags
checked
noTodo
unitTest
Return values
Query

        
On this page

Search results