baserCMS クラスリファレンス

SitesTable extends AppTable
in package
Uses BcContainerTrait

Class Site

サイトモデル

Table of Contents

Properties

$Contents  : ContentsTable
Contents
$publishBeginField  : string
公開開始日のフィールド AppTable::getConditionAllowPublish() で利用
$publishEndField  : string
公開終了日のフィールド AppTable::getConditionAllowPublish() で利用
$publishStatusField  : string
公開状態のフィールド AppTable::getConditionAllowPublish() で利用
$tmpEvents  : array<string|int, mixed>
一時イベント イベントを一時にオフにする場合に対象のコールバック処理を一時的に格納する
$_View  : View
View
$changedAlias  : bool
保存時にエイリアスが変更されたかどうか

Methods

addPrefix()  : string
テーブル名にプレフィックスを追加する
afterDelete()  : mixed
After Delete
afterSave()  : mixed
After Save
beforeSave()  : bool
Before Save
belongsToMany()  : BelongsToMany
Belongs To Many
changeSort()  : bool
並び順を変更する
children()  : ResultSetInterface
サイトを取得する
dispatchLayerEvent()  : bool|Event
イベントを発火
findByUrl()  : Site|EntityInterface
URLよりサイトを取得する
getConditionAllowPublish()  : array<string|int, mixed>
公開状態となっているデータを取得するための conditions 値を取得
getList()  : array<string|int, mixed>
サイトリストを取得
getMain()  : EntityInterface|false
メインサイトを取得する
getMainByUrl()  : array<string|int, mixed>|EntityInterface|null
URLに関連するメインサイトを取得する
getMax()  : int
指定フィールドのMAX値を取得する
getPrefix()  : false|string
プレフィックスを取得する
getPublishedAll()  : ResultSetInterface
公開されている全てのサイトを取得する
getRootContentId()  : int
サイトのルートとなるコンテンツIDを取得する
getRootMain()  : EntityInterface
メインサイトのデータを取得する
getSelectableDevices()  : array<string|int, mixed>
選択可能なデバイスの一覧を取得する
getSelectableLangs()  : array<string|int, mixed>
選択可能な言語の一覧を取得する
getService()  : array<string|int, mixed>|mixed|object
Get Service
getSubByUrl()  : mixed|null
URLに関連するサブサイトを取得する
getTable()  : string
テーブルを取得
getUrlPattern()  : array<string|int, mixed>
コンテンツのURLにマッチする候補を取得する
hasService()  : bool
Has Service
initialize()  : void
Initialize
isMain()  : bool
メインサイトかどうか判定する
newEntity()  : Site
offEvent()  : mixed
イベントを一時的にオフにする
onEvent()  : mixed
一時的にオフにしたイベントをオンにする BcModelEventDispatcherは対象外とする
pluginExistsByDasherize()  : bool
プラグインが存在するかどうか
replaceText()  : string
機種依存文字の変換処理
resetDevice()  : bool
デバイス設定をリセットする
resetLang()  : bool
言語設定をリセットする
save()  : bool
保存時に管理画面のセッション中のカレントサイトと同じデータの保存の場合、 セッションにも反映する
setTable()  : AppTable
テーブルをセット
sortdown()  : bool
一つ位置を下げる
sortup()  : bool
一つ位置を上げる
validationDefault()  : Validator
Validation Default

Properties

$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 = []

$changedAlias

保存時にエイリアスが変更されたかどうか

private bool $changedAlias = false

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

afterDelete()

After Delete

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

afterSave()

After Save

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

beforeSave()

Before Save

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

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

children()

サイトを取得する

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

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

findByUrl()

URLよりサイトを取得する

public findByUrl(string $url) : Site|EntityInterface
Parameters
$url : string
Tags
checked
noTodo
unitTest
Return values
Site|EntityInterface

getConditionAllowPublish()

公開状態となっているデータを取得するための conditions 値を取得

public getConditionAllowPublish() : array<string|int, mixed>

公開状態(初期値:status)、公開開始日(初期値:publish_begin)、公開終了日(初期値:publish_end) の組み合わせてによって配列を生成する。

公開状態が true であったとしても、公開期間が設定されている場合はそちらを優先する。

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

getList()

サイトリストを取得

public getList([bool $mainSiteId = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$mainSiteId : bool = null

メインサイトID

$options : array<string|int, mixed> = []
  • excludeIds : 除外するID(初期値:なし)
  • status : 有効かどうか(初期値:true)
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>

getMain()

メインサイトを取得する

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

getMainByUrl()

URLに関連するメインサイトを取得する

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

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

getPrefix()

プレフィックスを取得する

public getPrefix(mixed $id) : false|string
Parameters
$id : mixed

| $data

Tags
checked
noTodo
unitTest
Return values
false|string

getPublishedAll()

公開されている全てのサイトを取得する

public getPublishedAll() : ResultSetInterface
Tags
noTodo
checked
unitTest
Return values
ResultSetInterface

getRootContentId()

サイトのルートとなるコンテンツIDを取得する

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

getRootMain()

メインサイトのデータを取得する

public getRootMain([mixed $options = [] ]) : EntityInterface
Parameters
$options : mixed = []
  • fields : 取得するフィールド
Tags
checked
noTodo
unitTest
Return values
EntityInterface

getSelectableDevices()

選択可能なデバイスの一覧を取得する

public getSelectableDevices(int $mainSiteId, int $currentSiteId) : array<string|int, mixed>

現在のサイトとすでに利用されいているデバイスは除外する

Parameters
$mainSiteId : int

メインサイトID

$currentSiteId : int

現在のサイトID

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

getSelectableLangs()

選択可能な言語の一覧を取得する

public getSelectableLangs(int $mainSiteId, int $currentSiteId) : array<string|int, mixed>
Parameters
$mainSiteId : int

メインサイトID

$currentSiteId : int

現在のサイトID

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

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

getTable()

テーブルを取得

public getTable() : string

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

Tags
checked
noTodo
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>

hasService()

Has Service

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

initialize()

Initialize

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

テーブル設定

Tags
checked
noTodo
unitTest

isMain()

メインサイトかどうか判定する

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

newEntity()

public newEntity(mixed $data, array<string|int, mixed> $options = []) : Site
Parameters
$data : mixed
$options = [] : array<string|int, mixed>
Return values
Site

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

pluginExistsByDasherize()

プラグインが存在するかどうか

public pluginExistsByDasherize( $value) : bool

プラグイン名はダッシュライズに変換する前提とする ルーティング衝突の回避のため、プラグイン名と同じ名称は利用できない プラグインルーティングは、ダッシュライズ前提のため

Parameters
$value :
Return values
bool

replaceText()

機種依存文字の変換処理

public replaceText(string $str) : string

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

Parameters
$str : string

変換対象文字列

Tags
checked
noTodo
Return values
string

変換後文字列

resetDevice()

デバイス設定をリセットする

public resetDevice() : bool
Tags
checked
noTodo
unitTest
Return values
bool

resetLang()

言語設定をリセットする

public resetLang() : bool
Tags
checked
noTodo
unitTest
Return values
bool

save()

保存時に管理画面のセッション中のカレントサイトと同じデータの保存の場合、 セッションにも反映する

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

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

validationDefault()

Validation Default

public validationDefault(Validator $validator) : Validator

name / alias は、利用しているプラグインをハイフン区切りにした名称と同じ名称は利用できない フロントエンドのルーティングの際に、プラグインルーティングに奪われてしまい表示できないため

Parameters
$validator : Validator
Tags
checked
noTodo
unitTest
Return values
Validator

        
On this page

Search results