LabelTreeImport
class LabelTreeImport extendsImport
Properties
protectedstring | $path | Path to the directory with the import files. | from Import |
protectedCollection | $importLabelTrees | Caches the decoded label tree import file. | |
protectedUserImport | $userImport | The user import instance that belongs to this import. |
Methods
The files expected by this import.
Validate a file of this import.
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
Validates a CSV file to contain the expected columns.
Read a JSON file containing an array and wrap it in a Laravel collection.
Perform the import.
Get the contents of the label tree import file.
Get label trees that can be imported and don't already exist.
Get labels of existing label trees that can be imported.
Get users who might be implicitly imported along with a label tree.
Get the user import instance that belongs to this import.
Get the array that can be used to insert the label trees that should be imported.
Insert label trees that should be imported in the database.
Create label tree versions for imported versioned label trees.
Get IDs of label tree admins that should be imported.
Attach members to imported label trees.
Get the array that can be used to insert the labels that should be imported.
Insert labels that should be imported in the database.
Update/set the parent_id of imported labels.
Merge conflicts between import labels and existing labels.
Details
inImportat line23
__construct(string$path)
Create a new instance.
inImportat line33
bool
filesMatch()
Check if this import matches to the given import files.
inImportat line48
validateFiles()
Check if the files of this import are valid.
at line193
protectedarray
expectedFiles()
The files expected by this import.
inImportat line70
protectedarray
files()
Get the basename of each file of this import.
at line204
protected
validateFile(string$basename)
Validate a file of this import.
inImportat line98
protected
expectKeysInJson(string$file,array$expectation,bool$array =true)
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
inImportat line124
protected
expectColumnsInCsv(string$file,array$expectation)
Validates a CSV file to contain the expected columns.
inImportat line148
protectedCollection
collectJson(string$file)
Read a JSON file containing an array and wrap it in a Laravel collection.
at line42
array
perform(array$onlyTrees =null,array$onlyLabels =null,array$nameConflictResolution =[],array$parentConflictResolution =[])
Perform the import.
at line81
Collection
getImportLabelTrees()
Get the contents of the label tree import file.
at line95
Collection
getLabelTreeImportCandidates()
Get label trees that can be imported and don't already exist.
at line111
Collection
getLabelImportCandidates()
Get labels of existing label trees that can be imported.
If an import label exists but has a conflicting name or parent_id, it will get the additional conflicting_name and/or conflicting_parent_id attributes.
at line185
Collection
getUserImportCandidates()
Get users who might be implicitly imported along with a label tree.
at line231
protectedUserImport
getUserImport()
Get the user import instance that belongs to this import.
at line247
protectedCollection
getInsertLabelTrees(array|null$onlyTrees)
Get the array that can be used to insert the label trees that should be imported.
at line285
protectedarray
insertLabelTrees(Collection$trees)
Insert label trees that should be imported in the database.
at line309
protected
insertLabelTreeVersions(Collection$insertTrees,array$labelTreeIdMap)
Create label tree versions for imported versioned label trees.
at line333
protectedarray
getInsertUserIds(Collection$trees)
Get IDs of label tree admins that should be imported.
at line354
protected
attachLabelTreeMembers(Collection$trees,array$labelTreeIdMap,array$userIdMap)
Attach members to imported label trees.
at line388
protectedCollection
getInsertLabels(array|null$onlyLabels,array$labelTreeIdMap)
Get the array that can be used to insert the labels that should be imported.
at line417
protectedarray
insertLabels(Collection$labels,array$labelTreeIdMap)
Insert labels that should be imported in the database.
at line456
protected
updateInsertedLabelParentIds(Collection$labels,array$labelIdMap)
Update/set the parent_id of imported labels.
at line478
protected
mergeLabels(Collection$mergeLabels,array$nameConflictResolution,array$parentConflictResolution,array$labelIdMap)
Merge conflicts between import labels and existing labels.