class ImportResult implements JsonSerializable (View source)

Properties

protected ErrorList $errors

The list of import errros.

protected ErrorList $warnings

The list of import warnings.

protected int|null $lastDataRowIndex

The index of the last processed row (if any).

protected int $totalDataRowsProcessed

The total number of the data rows processed.

protected int $importSuccessCount

The total number successfully imported rows.

protected array|null $dataCollected

The data collected during the import process.

Methods

__construct(ErrorList $errors, ErrorList $warnings)

Initialize the instance.

getErrors()

Get the list of import errros.

getWarnings()

Get the list of import warnings.

$this
countRowProcessed(int $rowIndex)

Count a row as processed.

int|null
getLastDataRowIndex()

Get the index of the last processed row (if any).

int
getTotalDataRowsProcessed()

Get the total number of the data rows processed.

$this
setImportSuccessCount(int $value)

Set the total number successfully imported rows.

$this
increaseImportSuccessCount(int $count = 1)

Increase the total number successfully imported rows.

int
getImportSuccessCount()

Get the total number successfully imported rows.

$this
addLineProblem(bool $isError, string $problem, int|null $rowIndex = null)

Add an error message to the errors/warnings list.

jsonSerialize()

{@inheritdoc}

$this
setDataCollected(array $value = null)

Set the data collected during the import process.

array|null
getDataCollected()

Get the data collected during the import process.

Details

__construct(ErrorList $errors, ErrorList $warnings)

Initialize the instance.

Parameters

ErrorList $errors
ErrorList $warnings

ErrorList getErrors()

Get the list of import errros.

Return Value

ErrorList

ErrorList getWarnings()

Get the list of import warnings.

Return Value

ErrorList

$this countRowProcessed(int $rowIndex)

Count a row as processed.

Parameters

int $rowIndex

the index of the processed data row

Return Value

$this

int|null getLastDataRowIndex()

Get the index of the last processed row (if any).

Return Value

int|null

int getTotalDataRowsProcessed()

Get the total number of the data rows processed.

Return Value

int

$this setImportSuccessCount(int $value)

Set the total number successfully imported rows.

Parameters

int $value

Return Value

$this

$this increaseImportSuccessCount(int $count = 1)

Increase the total number successfully imported rows.

Parameters

int $count

Return Value

$this

int getImportSuccessCount()

Get the total number successfully imported rows.

Return Value

int

$this addLineProblem(bool $isError, string $problem, int|null $rowIndex = null)

Add an error message to the errors/warnings list.

Parameters

bool $isError

Is this a warning (false) or an error (true)?

string $problem

the problem message

int|null $rowIndex

the 0-index line index (if null: we'll assume the last row index)

Return Value

$this

jsonSerialize()

{@inheritdoc}

See also

\JsonSerializable::jsonSerialize()

$this setDataCollected(array $value = null)

Set the data collected during the import process.

Parameters

array $value

Return Value

$this

array|null getDataCollected()

Get the data collected during the import process.

Return Value

array|null

If the data is collected, you'll get an array with the keys:

  • attributeKeys: the list of attribute keys (\Concrete\Core\Attribute\AttributeKeyInterface[])
  • attributeControllers: the list of attribute key controllers (\Concrete\Core\Attribute\Controller[])
  • data: a list of array, whose keys are:
    • object: the object associated to the CSV data row (\Concrete\Core\Attribute\ObjectInterface)
    • attributeValues: the list of attribute values (array[\Concrete\Core\Entity\Attribute\Value\AbstractValue|null])