baserCMS クラスリファレンス

ContentsService
in package
implements ContentsServiceInterface Uses BcContainerTrait

Class ContentsService

Tags
checked
noTodo
unitTest

Table of Contents

Interfaces

ContentsServiceInterface
Interface ContentsServiceInterface

Properties

$Contents  : ContentsTable
$Contents  : ContentsTable
Contents
$Sites  : SitesTable
Sites

Methods

__construct()  : mixed
Construct
alias()  : EntityInterface
aliasを作成する
batch()  : bool
一括処理
convertTreeList()  : array<string|int, mixed>
ツリー構造のデータを コンボボックスのデータ用に変換する
copy()  : mixed
コピーする
create()  : EntityInterface|null
新規登録する 対応しない
delete()  : bool
コンテンツ情報を論理削除する
deleteAll()  : int
該当するコンテンツ情報をすべて論理削除する
deleteRecursive()  : void
再帰的に論理削除 ※ エイリアスの場合は直接削除
deleteSearchIndex()  : mixed
検索インデックスを削除する
encodeParsedUrl()  : array<string|int, mixed>
エンコードされたURLをデコードせずにパースする ※DBのレコードがエンコードされたまま保存されてる場合があるためその値を取得する際にデコードが邪魔になる際使用する
exists()  : bool
exists
existsContentByUrl()  : bool
指定したURLのパス上のコンテンツでフォルダ以外が存在するか確認
get()  : EntityInterface
コンテンツを取得する
getChildren()  : Query|null
コンテンツの子要素を取得する
getConditionAllowPublish()  : array<string|int, mixed>
公開済の conditions を取得
getContentFolderList()  : array<string|int, mixed>|bool
コンテンツフォルダーのリストを取得 コンボボックス用
getContentsInfo()  : array<string|int, mixed>
コンテンツ情報を取得する
getCrumbs()  : ResultSetInterface
パンくず用のコンテンツ一覧を取得する
getGlobalNavi()  : ResultSetInterface|false
グローバルナビ用のコンテンツ一覧を取得する
getIndex()  : Query
コンテンツ管理の一覧用のデータを取得
getList()  : array<string|int, mixed>
リストデータを取得
getLocalNavi()  : ResultSetInterface|void
ローカルナビ用のコンテンツ一覧を取得する
getNeighbors()  : array<string|int, mixed>
条件に基づいて指定したフィールドの隣のデータを所得する
getNew()  : EntityInterface
新しいデータの初期値を取得する
getNext()  : array<string|int, mixed>|EntityInterface|null
次のコンテンツを取得する
getParent()  : EntityInterface|false
親コンテンツを取得する
getParentLayoutTemplate()  : string
直属の親フォルダのレイアウトテンプレートを取得する
getPath()  : QueryInterface
ツリー構造のパスを取得する
getPrev()  : EntityInterface
前のコンテンツを取得する
getService()  : array<string|int, mixed>|mixed|object
Get Service
getSiteRoot()  : EntityInterface|null
サイトルートコンテンツを取得する
getTableIndex()  : Query
テーブル用のコンテンツ管理の一覧データを取得
getTitlesById()  : array<string|int, mixed>
IDを指定してタイトルリストを取得する
getTrash()  : EntityInterface|array<string|int, mixed>
ゴミ箱のコンテンツを取得する
getTrashIndex()  : Query
getTrashIndex
getTreeIndex()  : Query
getTreeIndex
getUrl()  : string
コンテンツ管理上のURLを元に正式なURLを取得する
getUrlById()  : string
コンテンツIDよりURLを取得する
hardDelete()  : bool
コンテンツ情報を削除する
hardDeleteAll()  : int
指定日時以前の該当する論理削除されたコンテンツ情報をすべて物理削除する
hardDeleteWithAssoc()  : bool
コンテンツ情報と紐付いてるモデルを物理削除する
hasService()  : bool
Has Service
isAllowPublish()  : bool
公開状態を取得する
isChangedStatus()  : bool
タイトル、URL、公開状態が更新されているか確認する
isMovable()  : bool
移動元のコンテンツと移動先のディレクトリから移動が可能かチェックする
isPublishById()  : bool
ID を指定して公開状態かどうか判定する
isTreeModifiedByAnotherUser()  : mixed
move()  : EntityInterface|bool|false
コンテンツを移動する
publish()  : EntityInterface
公開状態にする
rename()  : EntityInterface|null
リネーム処理
restore()  : EntityInterface|array<string|int, mixed>|null
論理削除されたコンテンツを復元する
restoreAll()  : int
ゴミ箱内のコンテンツをすべて元に戻す
saveSearchIndex()  : mixed
検索インデックスを生成する
setConditions()  : Query
テーブルインデックス用の条件を返す
setCurrentToRequest()  : false|ServerRequest
ServerRequest インスタンスに指定したコンテンツデータを現在のコンテンツとしてセットする
setTreeConfig()  : TreeBehavior
TreeBehaviorの設定値を更新する
softDeleteFromTree()  : bool
ツリー構造より論理削除する
unpublish()  : EntityInterface
非公開状態にする
update()  : EntityInterface|null
コンテンツ情報を更新する
moveRelateSubSiteContent()  : mixed
メインサイトの場合、連携設定がされている子サイトも移動する

Properties

Methods

__construct()

Construct

public __construct() : mixed
Tags
checked
noTodo
unitTest

alias()

aliasを作成する

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

batch()

一括処理

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

convertTreeList()

ツリー構造のデータを コンボボックスのデータ用に変換する

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

copy()

コピーする

public copy( $id,  $entityId,  $newTitle,  $newAuthorId[, mixed $newSiteId = null ]) : mixed
Parameters
$id :
$entityId :
$newTitle :
$newAuthorId :
$newSiteId : mixed = null
Tags
checked
noTodo
unitTest

create()

新規登録する 対応しない

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

delete()

コンテンツ情報を論理削除する

public delete(int $id) : bool

※ エイリアスの場合は直接削除 削除前に検索インデックスを削除するが、削除前でないと、ContentFolder の子の取得ができないため。

Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
bool

deleteAll()

該当するコンテンツ情報をすべて論理削除する

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

deleteRecursive()

再帰的に論理削除 ※ エイリアスの場合は直接削除

public deleteRecursive(int $id) : void
Parameters
$id : int
Tags
checked
noTodo
unitTest
throws
Exception

deleteSearchIndex()

検索インデックスを削除する

public deleteSearchIndex(int $id) : mixed

対象が ContentFolder の場合は、子の検索インデックスも削除する

Parameters
$id : int
Tags
checked
noTodo
unitTest

encodeParsedUrl()

エンコードされたURLをデコードせずにパースする ※DBのレコードがエンコードされたまま保存されてる場合があるためその値を取得する際にデコードが邪魔になる際使用する

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

$parsedUrl

exists()

exists

public exists(int $id[, bool $withTrash = false ]) : bool
Parameters
$id : int
$withTrash : bool = false

ゴミ箱の物も含めるか

Tags
checked
noTodo
unitTest
Return values
bool

existsContentByUrl()

指定したURLのパス上のコンテンツでフォルダ以外が存在するか確認

public existsContentByUrl( $url) : bool
Parameters
$url :
Tags
checked
unitTest
noTodo
Return values
bool

get()

コンテンツを取得する

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

getChildren()

コンテンツの子要素を取得する

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

getConditionAllowPublish()

公開済の conditions を取得

public getConditionAllowPublish() : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

公開条件(conditions 形式)

getContentFolderList()

コンテンツフォルダーのリストを取得 コンボボックス用

public getContentFolderList([int $siteId = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|bool
Parameters
$siteId : int = null
$options : array<string|int, mixed> = []
Tags
checked
unitTest
noTodo
Return values
array<string|int, mixed>|bool

getContentsInfo()

コンテンツ情報を取得する

public getContentsInfo() : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

getCrumbs()

パンくず用のコンテンツ一覧を取得する

public getCrumbs(int $id) : ResultSetInterface
Parameters
$id : int
Tags
checked
noTodo
Return values
ResultSetInterface

getGlobalNavi()

グローバルナビ用のコンテンツ一覧を取得する

public getGlobalNavi(int $id) : ResultSetInterface|false
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
ResultSetInterface|false

getIndex()

コンテンツ管理の一覧用のデータを取得

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

getList()

リストデータを取得

public getList() : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

getLocalNavi()

ローカルナビ用のコンテンツ一覧を取得する

public getLocalNavi(int $id) : ResultSetInterface|void
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
ResultSetInterface|void

getNeighbors()

条件に基づいて指定したフィールドの隣のデータを所得する

public getNeighbors(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Tags
throws
BcException

site_idがない場合Exceptionを投げる

checked
noTodo
unitTest
Return values
array<string|int, mixed>

$neighbors

getNew()

新しいデータの初期値を取得する

public getNew() : EntityInterface
Tags
checked
noTodo
unitTest
Return values
EntityInterface

getNext()

次のコンテンツを取得する

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

getParent()

親コンテンツを取得する

public getParent(int $id) : EntityInterface|false
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface|false

getParentLayoutTemplate()

直属の親フォルダのレイアウトテンプレートを取得する

public getParentLayoutTemplate(int $id[, int|null $parentId = null ]) : string
Parameters
$id : int
$parentId : int|null = null
Tags
checked
noTodo
unitTest
Return values
string

$parentTemplate|false

getPath()

ツリー構造のパスを取得する

public getPath(string $id) : QueryInterface
Parameters
$id : string
Tags
checked
noTodo
unitTest
Return values
QueryInterface

getPrev()

前のコンテンツを取得する

public getPrev(int $id) : EntityInterface
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface

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

getSiteRoot()

サイトルートコンテンツを取得する

public getSiteRoot(int $siteId) : EntityInterface|null
Parameters
$siteId : int
Tags
checked
unitTest
noTodo
Return values
EntityInterface|null

getTableIndex()

テーブル用のコンテンツ管理の一覧データを取得

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

getTitlesById()

IDを指定してタイトルリストを取得する

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

getTrash()

ゴミ箱のコンテンツを取得する

public getTrash(int $id) : EntityInterface|array<string|int, mixed>
Parameters
$id : int
Tags
throws
RecordNotFoundException
checked
noTodo
unitTest
Return values
EntityInterface|array<string|int, mixed>

getTrashIndex()

getTrashIndex

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

getTreeIndex()

getTreeIndex

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

getUrl()

コンテンツ管理上のURLを元に正式なURLを取得する

public getUrl(string $url[, bool $full = false ][, bool $useSubDomain = false ][, bool $base = false ]) : string

ドメインからのフルパスでない場合、デフォルトでは、 サブフォルダ設置時等の baseUrl(サブフォルダまでのパス)は含まない

Parameters
$url : string

コンテンツ管理上のURL

$full : bool = false

http からのフルのURLかどうか

$useSubDomain : bool = false

サブドメインを利用しているかどうか

$base : bool = false

$full が false の場合、ベースとなるURLを含めるかどうか

Tags
checked
unitTest
noTodo
Return values
string

URL

getUrlById()

コンテンツIDよりURLを取得する

public getUrlById(int $id[, mixed $full = false ]) : string
Parameters
$id : int
$full : mixed = false
Tags
checked
unitTest
noTodo
Return values
string

URL

hardDelete()

コンテンツ情報を削除する

public hardDelete(int $id[, bool $enableTree = false ]) : bool
Parameters
$id : int
$enableTree : bool = false

(デフォルト:false) TreeBehaviorの有無

Tags
checked
noTodo
unitTest
Return values
bool

hardDeleteAll()

指定日時以前の該当する論理削除されたコンテンツ情報をすべて物理削除する

public hardDeleteAll(Datetime $dateTime) : int
Parameters
$dateTime : Datetime
Tags
checked
noTodo
unitTest
Return values
int

hardDeleteWithAssoc()

コンテンツ情報と紐付いてるモデルを物理削除する

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

hasService()

Has Service

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

isAllowPublish()

公開状態を取得する

public isAllowPublish(Content $content[, mixed $self = false ]) : bool
Parameters
$content : Content

コンテンツデータ

$self : mixed = false
Tags
checked
noTodo
unitTest
Return values
bool

公開状態

isChangedStatus()

タイトル、URL、公開状態が更新されているか確認する

public isChangedStatus(int $id, array<string|int, mixed> $newData) : bool
Parameters
$id : int

コンテンツID

$newData : array<string|int, mixed>

新しいコンテンツデータ

Tags
checked
unitTest
noTodo
Return values
bool

isMovable()

移動元のコンテンツと移動先のディレクトリから移動が可能かチェックする

public isMovable(int $currentId, int $targetParentId) : bool
Parameters
$currentId : int

int 移動元コンテンツID

$targetParentId : int

int 移動先コンテンツID (ContentFolder)

Tags
checked
noTodo
unitTest
Return values
bool

isPublishById()

ID を指定して公開状態かどうか判定する

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

isTreeModifiedByAnotherUser()

public isTreeModifiedByAnotherUser(mixed $listDisplayed) : mixed
Parameters
$listDisplayed : mixed
Tags
checked
noTodo
unitTest

move()

コンテンツを移動する

public move(array<string|int, mixed> $origin, array<string|int, mixed> $target) : EntityInterface|bool|false

基本的に targetId の上に移動する前提となる targetId が空の場合は、同親中、一番下に移動する

Parameters
$origin : array<string|int, mixed>
$target : array<string|int, mixed>
Tags
checked
noTodo
unitTest
Return values
EntityInterface|bool|false

publish()

公開状態にする

public publish(int $id) : EntityInterface
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface

rename()

リネーム処理

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

restore()

論理削除されたコンテンツを復元する

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

$trash

restoreAll()

ゴミ箱内のコンテンツをすべて元に戻す

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

$count

saveSearchIndex()

検索インデックスを生成する

public saveSearchIndex( $id) : mixed

対象が ContentFolder の場合は、子の検索インデックスも更新する 子の検索インデックス更新時には、親の status を引き継ぐ

Parameters
$id :
Tags
checked
noTodo
unitTest

setConditions()

テーブルインデックス用の条件を返す

public setConditions(Query $query, array<string|int, mixed> $queryParams) : Query
Parameters
$query : Query
$queryParams : array<string|int, mixed>
Tags
checked
noTodo
Return values
Query

$query

setCurrentToRequest()

ServerRequest インスタンスに指定したコンテンツデータを現在のコンテンツとしてセットする

public setCurrentToRequest(string $type, int $entityId, ServerRequest $request) : false|ServerRequest
Parameters
$type : string
$entityId : int
$request : ServerRequest
Tags
checked
noTodo
unitTest
Return values
false|ServerRequest

setTreeConfig()

TreeBehaviorの設定値を更新する

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

softDeleteFromTree()

ツリー構造より論理削除する

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

unpublish()

非公開状態にする

public unpublish(int $id) : EntityInterface
Parameters
$id : int
Tags
checked
noTodo
unitTest
Return values
EntityInterface

update()

コンテンツ情報を更新する

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

moveRelateSubSiteContent()

メインサイトの場合、連携設定がされている子サイトも移動する

protected moveRelateSubSiteContent(mixed $mainCurrentId, mixed $mainTargetParentId, mixed $mainTargetId) : mixed
Parameters
$mainCurrentId : mixed
$mainTargetParentId : mixed
$mainTargetId : mixed
Tags
checked
unitTest
noTodo

        
On this page

Search results