AbstractImporter
abstract class AbstractImporter (View source)
Properties
protected Application | $app | The Application container instance. |
|
protected EntityManagerInterface | $entityManager | The EntityManager instance. |
|
private bool | $dryRun | Is the import process just a test? |
|
private Reader | $reader | The CSV Reader instance. |
|
private CategoryInterface | $category | The attribute category. |
|
private array|null | $attributeKeysAndControllers | The memoized attribute keys and controllers for the attribute category. |
|
private CsvSchema|null | $csvSchema | The CSV Schema. |
Methods
Process the CSV data.
Is the import process just a test?
Is the import process just a test?
Get the list of fixed headers.
Get or create a ObjectInterface instance starting from its static values.
Read the data rows and process them.
Set the CSV Reader instance.
Get the CSV Reader instance.
Get the attribute category to be used to export the data.
No description
Get a list the attribute keys and controllers for the current category.
Set/update the object attributes with the data read from the CSV.
Convert the data read from CSV to be passed to the attribute controller.
Details
protected
__construct(Reader $reader, CategoryInterface $category, Application $app)
Initialize the instance.
ImportResult
process(int $dataRowsToSkip = 0, int|null $maxDataRows = null, bool|int $collectData = false)
Process the CSV data.
bool
isDryRun()
Is the import process just a test?
$this
setDryRun(bool $value)
Is the import process just a test?
abstract protected string[]|Generator
getStaticHeaders()
Get the list of fixed headers.
abstract protected ObjectInterface
getObjectWithStaticValues(array $staticValues)
Get or create a ObjectInterface instance starting from its static values.
protected bool
processHeader(ImportResult $importResult)
Read the header row and initialize the CSV schema.
protected null|array
processData(ImportResult $importResult, int $dataRowsToSkip, int|null $maxDataRows, bool|int $collectData = false)
Read the data rows and process them.
protected $this
setReader(Reader $reader)
Set the CSV Reader instance.
protected Reader
getReader()
Get the CSV Reader instance.
protected $this
setCategory(CategoryInterface $category)
Set the attribute category to be used to export the data.
protected CategoryInterface
getCategory()
Get the attribute category to be used to export the data.
protected string[]|string[][]
getAttributesMap()
No description
protected array
getAttributeKeysAndControllers()
Get a list the attribute keys and controllers for the current category.
private
assignCsvAttributes(ObjectInterface $object, array $csvAttributes, ImportResult $importResult)
Set/update the object attributes with the data read from the CSV.
private string|string[]
convertCsvDataForAttributeController(Controller $attributeController, string|array $csvData)
Convert the data read from CSV to be passed to the attribute controller.