importer::__construct()
Runs the import from an external file or accessible URL. Assumes that the contents of the given URL is in well-formed cJSON or CSV format.
Prototype
importer __construct(repository $repo, array $options = [])
Parameters
- repo - Repository to import into.
- options - Optional associative array with any of the following keys.
- content_type - The content type of the objects in the import file. Required for CSV file imports where the content type is not specified in the file.
- only_validate - Set to TRUE to only perform the validation process. Do not actually import the objects. If FALSE or not specified, validation will be performed first, then the import if validation passes.
Example
$repo = comand::repo();
$importer = new \io_comand_util\importer($repo, ['only_validate'=>TRUE]);
$result = $importer->import_from_file('/file/path/import.json');