com\setasign\Konquadrat\Import\RowImport

ImportRelationsInterface Interface ImportRelationsInterface

File: /Konquadrat/src/Import/RowImport/ImportRelationsInterface.php

The import relations have the job to manage related import rows and objects.

Implemented in

Summary

Methods

deleteRows()

abstract public ImportRelationsInterface::deleteRows (
int[] $rowIds
): void

Removes the row from related rowIds. Should be triggered when the row is deleted in the preview.

Parameters
$rowIds : int[]
 

getObject()

Returns the matching object to the ident.

Parameters
$ident : string
 
Exceptions

Throws \BadMethodCallException If the object doesn't exist, no object is defined or the ident is unknown. Should never be thrown after hasObject($ident) === true.

hasObject()

abstract public ImportRelationsInterface::hasObject (
string $ident
): bool

Checks whether the ident already links to an created object.

Parameters
$ident : string
 

registerAndCompare()

abstract public ImportRelationsInterface::registerAndCompare (
MainImportRow $importRow,
callable $fetchIdentAndFieldsOfRow,
callable $findObjectByIdent,
callable $fetchFieldsOfObject
): void

Registers the row to the importRelations. If there is already another row or object for the ident the existing row/object will be compared to the importRow and register an error for the mismatching field (only if there isn't already an error in this field).

Note: you should validate and sanitize the row first because the row will be compared to the sanitized data (if the ident matches to another row).

Parameters
$importRow : MainImportRow
 
$fetchIdentAndFieldsOfRow : callable

function (MainImportRow $importRow): ImportRelationFieldsInterface[]

$findObjectByIdent : callable

function (string $ident): ?AbstractObject

$fetchFieldsOfObject : callable

function (AbstractObject $object): string[]

registerAndForbidDuplications()

abstract public ImportRelationsInterface::registerAndForbidDuplications (
MainImportRow $importRow,
callable $fetchIdentAndFieldsOfRow,
callable $findObjectByIdent
): void

Registers the row to the importRelations. If there is already another row or object for the ident an error will be registered for all fields in $fields.

Parameters
$importRow : MainImportRow
 
$fetchIdentAndFieldsOfRow : callable

function (MainImportRow $importRow): ImportRelationFieldsInterface

$findObjectByIdent : callable

function (string $ident): ?AbstractObject

registerObject()

Registers an object to the ident.

Parameters
$ident : string
 
$object : \com\setasign\Konquadrat\Object\AbstractObject