CoolCMS API

ImportSettingsDto
in package

FinalYes

Import settings. They exist in two instances and only one of them decides:

  • the job settings (admin form) are the only source of truth,
  • <settings> from the file are only a proposal; the validator lists differences as info log lines so the admin can see them, adjust the job settings in edit and revalidate.

Table of Contents

Constants

ACTION_SKIP  : string = 'skip'
ACTIONS  : array<string|int, mixed> = [self::MODE_CREATE, self::MODE_UPDATE, self::MO...
COLLECTION_MERGE  : string = 'merge'
COLLECTION_MODES  : array<string|int, mixed> = [self::COLLECTION_MERGE, self::COLLECTION_REPLACE]
COLLECTION_REPLACE  : string = 'replace'
MATCH_BY_CODE  : string = 'code'
MATCH_BY_EAN  : string = 'ean'
MATCH_BYS  : array<string|int, mixed> = [self::MATCH_BY_CODE, self::MATCH_BY_EAN]
MODE_CREATE  : string = 'create'
MODE_UPDATE  : string = 'update'
MODE_UPSERT  : string = 'upsert'
MODES  : array<string|int, mixed> = [self::MODE_UPSERT, self::MODE_CREATE, self::MO...

Properties

$autoCreateCategories  : bool
$autoCreateOptions  : bool
$autoCreateProducers  : bool
$collectionMode  : string
$defaultLang  : string
$matchBy  : string
$mode  : string
$stopOnError  : bool

Methods

__construct()  : mixed
diff()  : array<string, array{file: string|bool, job: string|bool}>
Returns keys in which the file `<settings>` differ from the job settings, as the base for `info` log lines (the job decides, but the admin should see the difference).
fromArray()  : self
Builds settings from the shape stored on the job ({@see \App\Core\Base\Shared\Eshop\Models\Entities\ProductImport::$settings}) or collected from the file `<settings>`; a missing key falls back to the default.
toArray()  : array<string, string|bool>
pickBool()  : bool
pickLang()  : string
pickString()  : string

Constants

ACTIONS

public array<string|int, mixed> ACTIONS = [self::MODE_CREATE, self::MODE_UPDATE, self::MODE_UPSERT, self::ACTION_SKIP]

per-item override of the job mode

COLLECTION_MODES

public array<string|int, mixed> COLLECTION_MODES = [self::COLLECTION_MERGE, self::COLLECTION_REPLACE]

MATCH_BYS

public array<string|int, mixed> MATCH_BYS = [self::MATCH_BY_CODE, self::MATCH_BY_EAN]

MODES

public array<string|int, mixed> MODES = [self::MODE_UPSERT, self::MODE_CREATE, self::MODE_UPDATE]

Properties

$collectionMode read-only

public string $collectionMode = self::COLLECTION_MERGE

Methods

__construct()

public __construct([string $mode = self::MODE_UPSERT ][, string $matchBy = self::MATCH_BY_CODE ][, string $defaultLang = 'cs' ][, string $collectionMode = self::COLLECTION_MERGE ][, bool $autoCreateProducers = true ][, bool $autoCreateOptions = false ][, bool $autoCreateCategories = false ][, bool $stopOnError = false ]) : mixed
Parameters
$mode : string = self::MODE_UPSERT
$matchBy : string = self::MATCH_BY_CODE
$defaultLang : string = 'cs'
$collectionMode : string = self::COLLECTION_MERGE
$autoCreateProducers : bool = true
$autoCreateOptions : bool = false
$autoCreateCategories : bool = false
$stopOnError : bool = false

diff()

Returns keys in which the file `<settings>` differ from the job settings, as the base for `info` log lines (the job decides, but the admin should see the difference).

public diff(self $other) : array<string, array{file: string|bool, job: string|bool}>
Parameters
$other : self
Return values
array<string, array{file: string|bool, job: string|bool}>

fromArray()

Builds settings from the shape stored on the job ({@see \App\Core\Base\Shared\Eshop\Models\Entities\ProductImport::$settings}) or collected from the file `<settings>`; a missing key falls back to the default.

public static fromArray(array<string, mixed> $values) : self
Parameters
$values : array<string, mixed>
Return values
self

toArray()

public toArray() : array<string, string|bool>
Return values
array<string, string|bool>

pickBool()

private static pickBool(array<string, mixed> $values, string $key, bool $default) : bool
Parameters
$values : array<string, mixed>
$key : string
$default : bool
Return values
bool

pickLang()

private static pickLang(array<string, mixed> $values) : string
Parameters
$values : array<string, mixed>
Return values
string

pickString()

private static pickString(array<string, mixed> $values, string $key, string $default, array<int, string> $allowed) : string
Parameters
$values : array<string, mixed>
$key : string
$default : string
$allowed : array<int, string>
Return values
string
On this page

Search results