CoolCMS API

ImportValidationContext
in package

FinalYes

State of one validation run: everything the validator carries between product cards (job settings, code lists, log writer, running summary) plus two registries that only make sense across the whole file:

  • $seenCodes detects the same code twice in one file. Only the code string (up to 20 characters) and the row number are kept, so even a huge file costs a few MB.
  • $accessoryRefs holds accessory references; an accessory may point to a code created in the same file, so references are resolved only after the last product.

Exists so that private validator methods do not pass eight parameters around. It is working state, not the file DTO (that lives in Import/Dto/).

Table of Contents

Properties

$accessoryRefs  : array<string, int>
$codebooks  : ImportCodebooks
$log  : ImportLogWriter
$matchesByCode  : array<string, array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}>>
Sets always keyed by code (even with `matchBy=ean`, where `matchesByKey` uses the EAN). The code is unique, so a foreign set with the same code is a hard error. With `matchBy=code` it equals {@see $matchesByKey}.
$matchesById  : array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}>
$matchesByKey  : array<string, array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}>>
Result of the batch DB query for the batch of product cards being processed: normalized match key (code or EAN according to `matchBy`) to sets.
$productIds  : array<int, true>
$productLanguageIds  : array<int, array<int, int>>
$seenBundleIds  : array<int, int>
$seenCodes  : array<string, int>
$seenMatchKeys  : array<string, int>
$settings  : ImportSettingsDto
$summary  : ImportValidationSummary

Methods

__construct()  : mixed

Properties

$accessoryRefs

public array<string, int> $accessoryRefs = []

accessory code to the row of its first reference

$matchesByCode

Sets always keyed by code (even with `matchBy=ean`, where `matchesByKey` uses the EAN). The code is unique, so a foreign set with the same code is a hard error. With `matchBy=code` it equals {@see $matchesByKey}.

public array<string, array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}>> $matchesByCode = []

$matchesById

public array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}> $matchesById = []

explicit id targets

$matchesByKey

Result of the batch DB query for the batch of product cards being processed: normalized match key (code or EAN according to `matchBy`) to sets.

public array<string, array<int, array{setId: int, productId: int|null, variantId: int|null, deleted: bool, code: string, ean: string|null, typeId: int, languageIds: list}>> $matchesByKey = []

$productIds

public array<int, true> $productIds = []

product card ids from the DB for explicit <product id=""> of the current batch

$productLanguageIds

public array<int, array<int, int>> $productLanguageIds = []

product card id to the languages of its existing texts (a card without <name lang> in a new language is an error)

$seenBundleIds

public array<int, int> $seenBundleIds = []

explicit <bundle id> in the file to the row of its first occurrence (a duplicate target is an error)

$seenCodes

public array<string, int> $seenCodes = []

normalized ProductSet.code to row. Kept next to $seenMatchKeys on purpose: with matchBy=ean they are two different sets, and accessories are always matched by code, never by the match key.

$seenMatchKeys

public array<string, int> $seenMatchKeys = []

normalized match key (code or EAN according to matchBy) to the row of its first occurrence

Methods

On this page

Search results