Field
extends Facade
in package
Class Field
Why not config/app.php の aliases(グローバル class_alias)に登録しない: グローバル名前空間に
既存のレガシー Field クラス(\Field、カスタムフィールドのデータオブジェクト本体)が存在するため、
class_alias(Acms\Services\Facades\Field::class, 'Field') は「Cannot redeclare class Field」警告を
発生させ実質失敗する(実測済み)。このファサードは use Acms\Services\Facades\Field as FieldFacade;
のように別名インポートするか、完全修飾名 \Acms\Services\Facades\Field::save(...) で利用する。
Table of Contents
Properties
- $container : Container
- $instance : mixed
- $resolvedFacades : mixed
- alias → 解決済みファサードクラス名の逆引き表。
Methods
- __callStatic() : mixed
- clearInstance() : void
- テスト用: ファサードがキャッシュしている解決済みインスタンスを破棄する。
- delete() : void
- deleteFieldCache() : void
- extract() : Field_Validation
- extractResult() : ExtractResult
- flushCache() : void
- getDeleteField() : Field
- getInstance() : mixed
- get service instance
- load() : Field
- save() : bool
- setContainer() : void
- swap() : void
- テスト用: サービスインスタンスをスタブ等へ差し替える。
- getServiceAlias() : string
- getServiceInstance() : mixed
- isCache() : bool
Properties
$container
protected
static Container
$container
$instance
protected
static mixed
$instance
$resolvedFacades
alias → 解決済みファサードクラス名の逆引き表。
protected
static mixed
$resolvedFacades
= []
どのサブクラスも再宣言していないため、全ファサード共通で Facade 基底の 1 テーブルを共有する。bind 変更時にどのファサードの static $instance を 破棄すべきか特定するのに使う。値は class-string => true の連想配列にして 重複登録を自然に排除する。
Methods
__callStatic()
public
static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
- $method : string
- $arguments : array<string|int, mixed>
clearInstance()
テスト用: ファサードがキャッシュしている解決済みインスタンスを破棄する。
public
static clearInstance() : void
isCache() が true のファサードは解決済みインスタンスを静的プロパティ $instance に 保持するため、コンテナ側だけを差し替えても反映されない。本メソッドでキャッシュを 無効化し、次回アクセスでコンテナから再解決させる。
delete()
public
static delete(string $type, mixed $id[, int|null $rvid = = 'null' ][, int|null $blogId = = 'null' ]) : void
カスタムフィールドを削除する
Parameters
- $type : string
- $id : mixed
- $rvid : int|null = = 'null'
- $blogId : int|null = = 'null'
deleteFieldCache()
public
static deleteFieldCache(string $type, mixed $id[, int|null $rvid = = 'null' ]) : void
フィールドキャッシュを削除する
Parameters
- $type : string
- $id : mixed
- $rvid : int|null = = 'null'
extract()
public
static extract([string $scp = = '\'field\'' ][, ACMS_Validator|null $V = = 'null' ][, Field|null $deleteField = = 'null' ]) : Field_Validation
POSTデータからフィールドを抜き出す
Parameters
- $scp : string = = '\'field\''
- $V : ACMS_Validator|null = = 'null'
- $deleteField : Field|null = = 'null'
Return values
Field_ValidationextractResult()
public
static extractResult([string $scp = = '\'field\'' ][, ACMS_Validator|null $V = = 'null' ][, Field|null $deleteField = = 'null' ]) : ExtractResult
POSTデータからフィールドと削除フィールドをまとめて抜き出す
Parameters
- $scp : string = = '\'field\''
- $V : ACMS_Validator|null = = 'null'
- $deleteField : Field|null = = 'null'
Return values
ExtractResultflushCache()
public
static flushCache() : void
フィールドキャッシュをフラッシュする
getDeleteField()
public
static getDeleteField() : Field
extract()後の削除フィールドを取得(非推奨。extractResult() を使うこと)
Return values
FieldgetInstance()
get service instance
public
static getInstance() : mixed
load()
public
static load([int|null $bid = = 'null' ][, int|null $uid = = 'null' ][, int|null $cid = = 'null' ][, int|null $mid = = 'null' ][, int|null $eid = = 'null' ][, string|null $unitId = = 'null' ][, int|null $rvid = = 'null' ][, bool $rewrite = = 'false' ]) : Field
カスタムフィールドを取得する
Parameters
- $bid : int|null = = 'null'
- $uid : int|null = = 'null'
- $cid : int|null = = 'null'
- $mid : int|null = = 'null'
- $eid : int|null = = 'null'
- $unitId : string|null = = 'null'
- $rvid : int|null = = 'null'
- $rewrite : bool = = 'false'
Return values
Fieldsave()
public
static save(string $type, mixed $id[, Field|null $field = = 'null' ][, Field|null $deleteField = = 'null' ][, int|null $rvid = = 'null' ][, int|null $targetBid = = 'null' ]) : bool
カスタムフィールドを保存する
Parameters
- $type : string
- $id : mixed
- $field : Field|null = = 'null'
- $deleteField : Field|null = = 'null'
- $rvid : int|null = = 'null'
- $targetBid : int|null = = 'null'
Return values
boolsetContainer()
public
static setContainer(Container $container) : void
Parameters
- $container : Container
swap()
テスト用: サービスインスタンスをスタブ等へ差し替える。
public
static swap(object $instance) : void
DI コンテナのエイリアスを差し替えたうえで、ファサードがキャッシュしている解決済み インスタンス(isCache() が true の場合)を破棄し、次回アクセス時に差し替え後の インスタンスを再解決させる。テスト後は元のインスタンスを渡して再度呼び出し復元する。
Parameters
- $instance : object
getServiceAlias()
protected
static getServiceAlias() : string
Return values
stringgetServiceInstance()
protected
static getServiceInstance(string $alias) : mixed
Parameters
- $alias : string
isCache()
protected
static isCache() : bool