baserCMS クラスリファレンス

ContentsTable extends AppTable
in package
Uses SoftDeleteTrait

Class ContentsTable

Table of Contents

Properties

$beforeSaveParentId  : null
保存前の親ID
$publishBeginField  : string
公開開始日のフィールド AppTable::getConditionAllowPublish() で利用
$publishEndField  : string
公開終了日のフィールド AppTable::getConditionAllowPublish() で利用
$publishStatusField  : string
公開状態のフィールド AppTable::getConditionAllowPublish() で利用
$Sites  : SitesTable
$tmpEvents  : array<string|int, mixed>
一時イベント イベントを一時にオフにする場合に対象のコールバック処理を一時的に格納する
$updatingRelated  : bool
関連データを更新する
$_View  : View
View
$softDeleteField  : string
論理削除フィールド名
$updatingSystemData  : bool
システムデータを更新する

Methods

addPrefix()  : string
テーブル名にプレフィックスを追加する
afterSave()  : void
afterSave
beforeMarshal()  : array<string|int, mixed>
Before Marshal
beforeSave()  : void
Before Save
belongsToMany()  : BelongsToMany
Belongs To Many
changeSort()  : bool
並び順を変更する
copyContentFolderPath()  : bool|null
現在のフォルダのURLを元に別サイトにフォルダを生成する 最下層のIDを返却する
createContent()  : EntityInterface|false
Content data を作成して保存する
createUrl()  : mixed
コンテンツデータよりURLを生成する
deleteAlias()  : void
自データのエイリアスを削除する
deleteByType()  : bool
タイプよりコンテンツを削除する
deleteRelateSubSiteContent()  : void
メインサイトの場合、連携設定がされている子サイトのエイリアス削除する
disableUpdatingSystemData()  : void
UpdatingSystemData無効化
dispatchLayerEvent()  : bool|Event
イベントを発火
duplicateRelatedSiteContent()  : bool
サイト設定にて、エイリアスを利用してメインサイトと自動連携するオプションを利用時に、 関連するサブサイトで、関連コンテンツを作成する際、同階層に重複名称のコンテンツがないか確認する
enableUpdatingSystemData()  : void
UpdatingSystemData有効化
findByType()  : array<string|int, mixed>
タイプよりコンテンツを取得する
findByUrl()  : mixed
URLに関連するコンテンツ情報を取得する サイト情報を含む
getConditionAllowPublish()  : array<string|int, mixed>
公開済の conditions を取得
getMax()  : int
指定フィールドのMAX値を取得する
getOrderSameParent()  : bool|int|null
同じ階層における並び順を取得
getParentTemplate()  : mixed
親のテンプレートを取得する
getRelatedSiteContents()  : array<string|int, mixed>|false
関連サイトの関連コンテンツを取得する
getTable()  : string
テーブルを取得
getTrash()  : EntityInterface|array<string|int, mixed>
ゴミ箱のコンテンツを取得する
getUniqueName()  : string
一意の name 値を取得する
getUrlPattern()  : array<string|int, mixed>
コンテンツのURLにマッチする候補を取得する
implementedEvents()  : array<string|int, mixed>
Implemented Events
initialize()  : void
Initialize
isPublish()  : bool
データが公開済みかどうかチェックする
isPublishById()  : bool
ID を指定して公開状態かどうか判定する
moveOffset()  : EntityInterface|bool
オフセットを元にコンテンツを移動する
notEmptyString()  : bool
最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す
offEvent()  : mixed
イベントを一時的にオフにする
onEvent()  : mixed
一時的にオフにしたイベントをオンにする BcModelEventDispatcherは対象外とする
pureUrl()  : string
サブサイトのプレフィックスがついていない純粋なURLを取得
replaceText()  : string
機種依存文字の変換処理
resetTree()  : mixed
コンテンツ管理のツリー構造をリセットする
setTable()  : AppTable
テーブルをセット
sortdown()  : bool
一つ位置を下げる
sortup()  : bool
一つ位置を上げる
updateAllUrl()  : bool
全てのURLをデータの状況に合わせ更新する
updateChildren()  : bool
子ノードのシステムデータを全て更新する
updateChildrenUrl()  : mixed
指定したコンテンツ配下のコンテンツのURLを一括更新する
validationDefault()  : Validator
Validation Default
textFormatting()  : string
できるだけ可読性を高める為、不要な記号は除外する
updatePublishDate()  : Content
公開・非公開の日時を更新する
updateRelateSubSiteContent()  : bool
メインサイトの場合、連携設定がされている子サイトのエイリアスを追加・更新する
updateSystemData()  : EntityInterface|false
システムデータを更新する
urlEncode()  : string
URL用に文字列を変換する

Properties

$beforeSaveParentId

保存前の親ID

public null $beforeSaveParentId = null

IDの変更比較に利用

$publishBeginField

公開開始日のフィールド AppTable::getConditionAllowPublish() で利用

public string $publishBeginField = 'publish_begin'

$publishEndField

公開終了日のフィールド AppTable::getConditionAllowPublish() で利用

public string $publishEndField = 'publish_end'

$publishStatusField

公開状態のフィールド AppTable::getConditionAllowPublish() で利用

public string $publishStatusField = 'status'

$tmpEvents

一時イベント イベントを一時にオフにする場合に対象のコールバック処理を一時的に格納する

public array<string|int, mixed> $tmpEvents = []

$updatingRelated

関連データを更新する

public bool $updatingRelated = true

$softDeleteField

論理削除フィールド名

protected string $softDeleteField = 'deleted_date'

$updatingSystemData

システムデータを更新する

protected bool $updatingSystemData = true

Methods

addPrefix()

テーブル名にプレフィックスを追加する

public addPrefix( $table) : string

$this->getConnection()->config() を利用するとユニットテストで問題が発生するため、BcUtil::getCurrentDbConfig()を利用する

$this->getConnection()->config()を利用すると、 そのテーブルに connection が設定されてしまう。

ユニットテストの dataProvider で、テーブルを初期化する場合、 タイミング的に、接続についてテスト用のエイリアスが設定されていないので、 テスト用の接続ではなく、 default がセットされてしまう。

Parameters
$table :
Tags
checked
noTodo
Return values
string

afterSave()

afterSave

public afterSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface
$entity : EntityInterface
$options : ArrayObject
Tags
checked
noTodo
unitTest

beforeMarshal()

Before Marshal

public beforeMarshal(EventInterface $event, ArrayObject $content, ArrayObject $options) : array<string|int, mixed>
Parameters
$event : EventInterface
$content : ArrayObject
$options : ArrayObject
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

$content

beforeSave()

Before Save

public beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface
$entity : EntityInterface
$options : ArrayObject
Tags
checked
noTodo
unitTest

belongsToMany()

Belongs To Many

public belongsToMany(string $associated[, array<string|int, mixed> $options = [] ]) : BelongsToMany

joinTable にプレフィックスを追加

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

changeSort()

並び順を変更する

public changeSort(string $id, int $offset[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$id : string
$offset : int
$options : array<string|int, mixed> = []
  • conditions: データ取得条件
  • sortFieldName: ソートフィールドのカラム名 (初期値: sort)
Tags
checked
noTodo
Return values
bool

copyContentFolderPath()

現在のフォルダのURLを元に別サイトにフォルダを生成する 最下層のIDを返却する

public copyContentFolderPath( $currentUrl,  $targetSiteId) : bool|null
Parameters
$currentUrl :
$targetSiteId :
Tags
checked
unitTest
noTodo
Return values
bool|null

createContent()

Content data を作成して保存する

public createContent(array<string|int, mixed> $content, string $plugin, string $type[, int $entityId = null ][, mixed $validate = true ]) : EntityInterface|false
Parameters
$content : array<string|int, mixed>
$plugin : string
$type : string
$entityId : int = null
$validate : mixed = true
Tags
checked
noTodo
unitTest
Return values
EntityInterface|false

createUrl()

コンテンツデータよりURLを生成する

public createUrl(int $id) : mixed
Parameters
$id : int

コンテンツID

Tags
checked
unitTest
noTodo
Return values
mixed

URL | false

deleteAlias()

自データのエイリアスを削除する

public deleteAlias(EntityInterface $content) : void

全サイトにおけるエイリアスを全て削除

Parameters
$content : EntityInterface
Tags
checked
noTodo
unitTest

deleteByType()

タイプよりコンテンツを削除する

public deleteByType(string $type[, int $entityId = null ]) : bool
Parameters
$type : string

例)Blog.BlogContent

$entityId : int = null
Return values
bool

deleteRelateSubSiteContent()

メインサイトの場合、連携設定がされている子サイトのエイリアス削除する

public deleteRelateSubSiteContent(EntityInterface $content) : void
Parameters
$content : EntityInterface
Tags
checked
noTodo
unitTest

disableUpdatingSystemData()

UpdatingSystemData無効化

public disableUpdatingSystemData() : void
Tags
checked
noTodo
unitTest

dispatchLayerEvent()

イベントを発火

public dispatchLayerEvent(string $name[, array<string|int, mixed> $data = [] ][, mixed $options = [] ]) : bool|Event
Parameters
$name : string
$data : array<string|int, mixed> = []
$options : mixed = []
Tags
checked
unitTest
noTodo
Return values
bool|Event

duplicateRelatedSiteContent()

サイト設定にて、エイリアスを利用してメインサイトと自動連携するオプションを利用時に、 関連するサブサイトで、関連コンテンツを作成する際、同階層に重複名称のコンテンツがないか確認する

public duplicateRelatedSiteContent( $check) : bool
  • 新規の際は、存在するだけでエラー
  • 編集の際は、main_site_content_id が自身のIDでない、alias_id が自身のIDでない場合エラー
Parameters
$check :
Return values
bool

enableUpdatingSystemData()

UpdatingSystemData有効化

public enableUpdatingSystemData() : void
Tags
checked
noTodo
unitTest

findByType()

タイプよりコンテンツを取得する

public findByType(string $type[, int $entityId = null ]) : array<string|int, mixed>
Parameters
$type : string

例)Blog.BlogContent

$entityId : int = null
Tags
checked
unitTest
noTodo
Return values
array<string|int, mixed>

findByUrl()

URLに関連するコンテンツ情報を取得する サイト情報を含む

public findByUrl(string $url[, bool $publish = true ][, bool $extend = false ][, bool $sameUrl = false ][, bool $useSubDomain = false ]) : mixed
Parameters
$url : string

検索対象のURL

$publish : bool = true

公開状態かどうか

$extend : bool = false

拡張URLに対応するかどうか /news/ というコンテンツが存在する場合、/news/archives/1 で検索した際にヒットさせる

$sameUrl : bool = false

対象をメインサイトと同一URLで表示するサイト設定内のコンテンツするかどうか

$useSubDomain : bool = false

対象をサブドメインを利用しているサイト設定内のコンテンツをするかどうか

Tags
checked
noTodo
unitTest
Return values
mixed

false|array Content データ

getConditionAllowPublish()

公開済の conditions を取得

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

公開条件(conditions 形式)

getMax()

指定フィールドのMAX値を取得する

public getMax(string $field[, array<string|int, mixed> $conditions = [] ]) : int

現在数値フィールドのみ対応

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

getOrderSameParent()

同じ階層における並び順を取得

public getOrderSameParent(string $id, int $parentId) : bool|int|null

id が空の場合は、一番最後とみなす

Parameters
$id : string
$parentId : int
Tags
checked
noTodo
unitTest
Return values
bool|int|null

getParentTemplate()

親のテンプレートを取得する

public getParentTemplate( $id) : mixed
Parameters
$id :
Tags
checked
unitTest
noTodo

getRelatedSiteContents()

関連サイトの関連コンテンツを取得する

public getRelatedSiteContents(int $id[, mixed $options = [] ]) : array<string|int, mixed>|false
Parameters
$id : int
$options : mixed = []
Return values
array<string|int, mixed>|false

getTable()

テーブルを取得

public getTable() : string

プレフィックスを追加する

Tags
checked
noTodo
Return values
string

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>

getUniqueName()

一意の name 値を取得する

public getUniqueName(string $name, mixed $parentId[, mixed $contentId = null ]) : string
Parameters
$name : string

name フィールドの値

$parentId : mixed
$contentId : mixed = null
Tags
checked
noTodo
unitTest
Return values
string

getUrlPattern()

コンテンツのURLにマッチする候補を取得する

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

implementedEvents()

Implemented Events

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

initialize()

Initialize

public initialize(array<string|int, mixed> $config) : void
Parameters
$config : array<string|int, mixed>

テーブル設定

Tags
checked
noTodo
unitTest

isPublish()

データが公開済みかどうかチェックする

public isPublish(bool $status, string $publishBegin, string $publishEnd) : bool
Parameters
$status : bool

公開ステータス

$publishBegin : string

公開開始日時

$publishEnd : string

公開終了日時

Tags
checked
unitTest
noTodo
Return values
bool

isPublishById()

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

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

moveOffset()

オフセットを元にコンテンツを移動する

public moveOffset( $id,  $offset) : EntityInterface|bool
Parameters
$id :
$offset :
Tags
checked
noTodo
unitTest
Return values
EntityInterface|bool

notEmptyString()

最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す

public static notEmptyString(mixed $value, int $max) : bool
Parameters
$value : mixed

対象となる値

$max : int

バイト数の最大値

Tags
checked
noTodo
unitTest
Return values
bool

offEvent()

イベントを一時的にオフにする

public offEvent(string $eventKey) : mixed
Parameters
$eventKey : string
Tags
checked
noTodo

onEvent()

一時的にオフにしたイベントをオンにする BcModelEventDispatcherは対象外とする

public onEvent(string $eventKey) : mixed
Parameters
$eventKey : string
Tags
checked
noTodo
unitTest

pureUrl()

サブサイトのプレフィックスがついていない純粋なURLを取得

public pureUrl(string $url, int $siteId) : string
Parameters
$url : string
$siteId : int
Tags
checked
noTodo
unitTest
Return values
string

replaceText()

機種依存文字の変換処理

public replaceText(string $str) : string

内部文字コードがUTF-8である必要がある。 多次元配列には対応していない。

Parameters
$str : string

変換対象文字列

Tags
checked
noTodo
Return values
string

変換後文字列

resetTree()

コンテンツ管理のツリー構造をリセットする

public resetTree() : mixed
Tags
checked
noTodo
unitTest

setTable()

テーブルをセット

public setTable(string $table) : AppTable

プレフィックスを追加する

Parameters
$table : string
Tags
checked
noTodo
Return values
AppTable

sortdown()

一つ位置を下げる

public sortdown(string $id, array<string|int, mixed> $conditions) : bool
Parameters
$id : string
$conditions : array<string|int, mixed>
Tags
checked
noTodo
Return values
bool

sortup()

一つ位置を上げる

public sortup(string $id, array<string|int, mixed> $conditions) : bool
Parameters
$id : string
$conditions : array<string|int, mixed>
Tags
checked
noTodo
Return values
bool

updateAllUrl()

全てのURLをデータの状況に合わせ更新する

public updateAllUrl() : bool
Return values
bool

updateChildren()

子ノードのシステムデータを全て更新する

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

updateChildrenUrl()

指定したコンテンツ配下のコンテンツのURLを一括更新する

public updateChildrenUrl( $id) : mixed
Parameters
$id :
Tags
checked
unitTest
noTodo

validationDefault()

Validation Default

public validationDefault(Validator $validator) : Validator
Parameters
$validator : Validator
Tags
checked
noTodo
unitTest
Return values
Validator

textFormatting()

できるだけ可読性を高める為、不要な記号は除外する

protected textFormatting( $value) : string
Parameters
$value :
Tags
checked
noTodo
unitTest
Return values
string

updatePublishDate()

公開・非公開の日時を更新する

protected updatePublishDate(Content $content) : Content
Parameters
$content : Content
Tags
checked
unitTest
noTodo
Return values
Content

$content

updateRelateSubSiteContent()

メインサイトの場合、連携設定がされている子サイトのエイリアスを追加・更新する

protected updateRelateSubSiteContent(Content $data) : bool
Parameters
$data : Content
Tags
checked
noTodo
unitTest
Return values
bool

updateSystemData()

システムデータを更新する

protected updateSystemData(Content $content) : EntityInterface|false

URL / 公開状態 / メインサイトの関連コンテンツID

Parameters
$content : Content
Tags
checked
unitTest
noTodo
Return values
EntityInterface|false

urlEncode()

URL用に文字列を変換する

protected urlEncode( $value) : string
Parameters
$value :
Tags
checked
noTodo
unitTest
Return values
string

        
On this page

Search results