Export
in package
コンフィグセット単体のエクスポート処理。フォーム/モジュールのエクスポートと同様に専用クラスとして用意する。
永続化・変換は RepositoryInterface に閉じる。インポートは Import に分離している。 エクスポートは再インポート可能な原本(生レコード)を出力するため、Repository::findRawById / findConfigRows を用いる。認可(config_set 管理権限)と CSRF はハンドラ側の責務とする。
Table of Contents
Constants
- CATEGORY_ID_CONFIG_KEYS = ['entry_edit_category_default', 'entry_edit_category_filter', 'entry_edit_sub_category_filter', 'static_page_cid', 'static_archive_cid']
- カテゴリーIDを値として保持する config キー。
Properties
Methods
- __construct() : mixed
- toArray() : array<string, mixed>
- コンフィグセット1件をエクスポート用の配列に変換する
- toYaml() : string
- コンフィグセット1件を YAML 文字列としてエクスポートする
- convertCategoryIdToCode() : array<string, mixed>
- カテゴリー参照キーの config_value を category_id から category_code へ変換する。 変換できない(category_code が未解決)場合は元の値のまま返す (インポート側で持ち込み先ブログとの突合に失敗し、従来通りクリアされる)。
- isNotRuleSpecific() : bool
- config_rule_id(ルール別上書き設定の紐付け先)が設定されている行はエクスポート対象外にする。 rule_id はブログごとの auto-increment で他ブログと値の互換性が無く、かつ rule_name は 一意性の保証が無い(同名の別ルールを複数作成できる)ため、ルール名による自動突合は 意図しないルールへの誤った紐付けを招く可能性がある。ルールの表示条件そのものが インポート先で同じ意味を持つとも限らないため、ルール別上書きは常に対象外とする(CMS-7831)。
Constants
CATEGORY_ID_CONFIG_KEYS
カテゴリーIDを値として保持する config キー。
private
array<string|int, string>
CATEGORY_ID_CONFIG_KEYS
= ['entry_edit_category_default', 'entry_edit_category_filter', 'entry_edit_sub_category_filter', 'static_page_cid', 'static_archive_cid']
Import::CATEGORY_ID_CONFIG_KEYS と同じ一覧。category_id はブログごとの auto-increment で他ブログと値の互換性が無いため、エクスポート時に安定した自然キーである category_code へ変換しておく(インポート側で先方ブログの category_code から category_id を引き直す。CMS-7831)。
Properties
$repository
private
RepositoryInterface
$repository
Methods
__construct()
public
__construct([RepositoryInterface|null $repository = null ]) : mixed
Parameters
- $repository : RepositoryInterface|null = null
toArray()
コンフィグセット1件をエクスポート用の配列に変換する
public
toArray(int $configSetId) : array<string, mixed>
Parameters
- $configSetId : int
Return values
array<string, mixed>toYaml()
コンフィグセット1件を YAML 文字列としてエクスポートする
public
toYaml(int $configSetId) : string
Parameters
- $configSetId : int
Return values
stringconvertCategoryIdToCode()
カテゴリー参照キーの config_value を category_id から category_code へ変換する。 変換できない(category_code が未解決)場合は元の値のまま返す (インポート側で持ち込み先ブログとの突合に失敗し、従来通りクリアされる)。
private
convertCategoryIdToCode(array<string, mixed> $record) : array<string, mixed>
Parameters
- $record : array<string, mixed>
Return values
array<string, mixed>isNotRuleSpecific()
config_rule_id(ルール別上書き設定の紐付け先)が設定されている行はエクスポート対象外にする。 rule_id はブログごとの auto-increment で他ブログと値の互換性が無く、かつ rule_name は 一意性の保証が無い(同名の別ルールを複数作成できる)ため、ルール名による自動突合は 意図しないルールへの誤った紐付けを招く可能性がある。ルールの表示条件そのものが インポート先で同じ意味を持つとも限らないため、ルール別上書きは常に対象外とする(CMS-7831)。
private
isNotRuleSpecific(array<string, mixed> $record) : bool
Parameters
- $record : array<string, mixed>