Export
in package
フォームのエクスポート処理。エントリー/ブログ/モジュールのエクスポートと同様に専用クラスとして用意する。
永続化・変換は RepositoryInterface に閉じる。インポートは Import に分離している。 エクスポートは再インポート可能な原本(生レコード)を出力するため、Repository::findRawById を用いる。 認可(form_view / form_edit ロール等)と CSRF はハンドラ側の責務とする。
Table of Contents
Properties
Methods
- __construct() : mixed
- toArray() : array<string, mixed>
- フォーム1件をエクスポート用の配列に変換する
- toYaml() : string
- フォーム1件を YAML 文字列としてエクスポートする
Properties
$repository
private
RepositoryInterface
$repository
Methods
__construct()
public
__construct([RepositoryInterface|null $repository = null ]) : mixed
Parameters
- $repository : RepositoryInterface|null = null
toArray()
フォーム1件をエクスポート用の配列に変換する
public
toArray(int $formId) : array<string, mixed>
フォームは form テーブル単一行で完結し外部エンティティ参照を持たないため、 生レコードをそのまま 'form' 配下に格納する(モジュールのような meta ID 変換は不要)。
Parameters
- $formId : int
Return values
array<string, mixed>toYaml()
フォーム1件を YAML 文字列としてエクスポートする
public
toYaml(int $formId) : string
Parameters
- $formId : int