ImportExecutionSummary
in package
Running summary of a live run (job states, batching): what is written to the job after each batch (`processedItems`, `createdCount`, ...) and what decides `done` or `failed` at the end.
An item is a variant (ProductSet), as in ImportValidationSummary. A mutable accumulator
filled by ImportProductWriter through ImportExecutionContext.
Table of Contents
Properties
- $aborted : bool
- The run failed as a whole (exception outside an item: parser in the middle of the stream, batch matching, `em->clear()`, second pass...). The counts above are then the true state up to the failure (already accepted writes are not rolled back); the job ends as `failed`.
- $accessoryQueue : array<int, ImportAccessoryDto>, code: string|null, action: string, line: int}>
- Accessories collected during the run, resolved in a second pass after all cards are done, because a code may point to a set created later in the same file.
- $codeToSetId : array<string, int>
- Normalized `ProductSet.code` => id, filled by the writer after every create or update of a set.
- $createdCount : int
- $errorCount : int
- Items that were not written (hard validation error or write failure).
- $processedItems : int
- $skippedCount : int
- $stopped : bool
- `stopOnError` stopped the run; the job ends as `failed`.
- $totalItems : int
- $touchedSetIds : array<int, true>
- $updatedCount : int
- $urlToAssetId : array<string, int>
- Source image URL => id of an already created or found asset (cache by URL: a repeated `<image src>` with the same URL in the file is downloaded once). Filled by the writer after every dedup hit (DB or this run) and every successful download and upload. It survives `em->clear()` between batches because it is only a scalar map, like `$codeToSetId`.
- $warningCount : int
- Log rows of level `warning` (soft errors).
Methods
- forgetSets() : void
- Compensation of a create ({@see ImportProductWriter} `rollbackCreated()`) removes the sets from the run lookup registries: code => id (otherwise accessories or a bundle would get the id of a deleted set from the cache without a DB query) and the accessories queue (the owner is not an accepted item). Only entries pointing to these ids are removed; a code remapped to another set stays. `touchedSetIds` is handled by the caller (leftovers after a failed cleanup exist in the DB, so reindex applies).
- isStopped() : bool
- Reads `stopped` through a method because a writer may have set it meanwhile through the context (static analysis would otherwise remember the property value from an earlier condition).
- registerCode() : void
- Called by the writer after every successful write of a set (create or update); see {@see $codeToSetId}.
- registerImageUrl() : void
- Called by the writer after a dedup hit and after a new download and upload of an image; see {@see $urlToAssetId}.
- toArray() : array<string, int|bool>
- touchSet() : void
Properties
$aborted
The run failed as a whole (exception outside an item: parser in the middle of the stream, batch matching, `em->clear()`, second pass...). The counts above are then the true state up to the failure (already accepted writes are not rolled back); the job ends as `failed`.
public
bool
$aborted
= false
$accessoryQueue
Accessories collected during the run, resolved in a second pass after all cards are done, because a code may point to a set created later in the same file.
public
array<int, ImportAccessoryDto>, code: string|null, action: string, line: int}>
$accessoryQueue
= []
$codeToSetId
Normalized `ProductSet.code` => id, filled by the writer after every create or update of a set.
public
array<string, int>
$codeToSetId
= []
The accessories second pass (ImportProductWriter::resolveAccessories())
needs it for codes created in the same file. It survives em->clear() between batches because it
is only a scalar map.
$createdCount
public
int
$createdCount
= 0
$errorCount
Items that were not written (hard validation error or write failure).
public
int
$errorCount
= 0
$processedItems
public
int
$processedItems
= 0
$skippedCount
public
int
$skippedCount
= 0
$stopped
`stopOnError` stopped the run; the job ends as `failed`.
public
bool
$stopped
= false
$totalItems
public
int
$totalItems
= 0
$touchedSetIds
public
array<int, true>
$touchedSetIds
= []
ids of sets the run touched (write or activation); reindexed in ES after the run
$updatedCount
public
int
$updatedCount
= 0
$urlToAssetId
Source image URL => id of an already created or found asset (cache by URL: a repeated `<image src>` with the same URL in the file is downloaded once). Filled by the writer after every dedup hit (DB or this run) and every successful download and upload. It survives `em->clear()` between batches because it is only a scalar map, like `$codeToSetId`.
public
array<string, int>
$urlToAssetId
= []
$warningCount
Log rows of level `warning` (soft errors).
public
int
$warningCount
= 0
Methods
forgetSets()
Compensation of a create ({@see ImportProductWriter} `rollbackCreated()`) removes the sets from the run lookup registries: code => id (otherwise accessories or a bundle would get the id of a deleted set from the cache without a DB query) and the accessories queue (the owner is not an accepted item). Only entries pointing to these ids are removed; a code remapped to another set stays. `touchedSetIds` is handled by the caller (leftovers after a failed cleanup exist in the DB, so reindex applies).
public
forgetSets(array<int, int> $setIds) : void
Parameters
- $setIds : array<int, int>
isStopped()
Reads `stopped` through a method because a writer may have set it meanwhile through the context (static analysis would otherwise remember the property value from an earlier condition).
public
isStopped() : bool
Return values
boolregisterCode()
Called by the writer after every successful write of a set (create or update); see {@see $codeToSetId}.
public
registerCode(string $code, int $setId) : void
Parameters
- $code : string
- $setId : int
registerImageUrl()
Called by the writer after a dedup hit and after a new download and upload of an image; see {@see $urlToAssetId}.
public
registerImageUrl(string $url, int $assetId) : void
Parameters
- $url : string
- $assetId : int
toArray()
public
toArray() : array<string, int|bool>
Return values
array<string, int|bool>touchSet()
public
touchSet(int $setId) : void
Parameters
- $setId : int