modules/Import/sources/ImportFile.php
\ImportFile
- Parent(s)
- \ImportDataSource < ?\Iterator
Properties

$_createdCount= '0'
0Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_createdCount

$_currentRow= 'FALSE'
Array of the values in the current array we are in
Inherited from: \ImportDataSource::$$_currentRowFALSEDetails- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_currentRow

$_dataSet= 'array()'
Stores a subset or entire portion of the data set requested.
Inherited from: \ImportDataSource::$$_dataSetarray()Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_dataSet

$_deleteFile= ''
Stores whether or not we are deleting the import file in the destructor
- Type
- n/a

$_importFile= 'null'
The import file map that this import file inherits properties from.
nullDetails- Type
- n/a

$_localeSettings= 'array()'
Holds any locale settings needed for import. These can be provided by the user or explicitly set by the user.
Inherited from: \ImportDataSource::$$_localeSettingsarray()Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_localeSettings

$_offset= '0'
The current offset the data set should start at
Inherited from: \ImportDataSource::$$_offset0Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_offset

$_rowCountedForErrors= 'false'
True if the current row has already had an error it in, so we don't increase the $_errorCount
Inherited from: \ImportDataSource::$$_rowCountedForErrorsfalseDetails- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_rowCountedForErrors

$_sourcename= ''
Sourcename used as an identifier for this import
Inherited from: \ImportDataSource::$$_sourcename- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_sourcename

$_updatedCount= '0'
0Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_updatedCount
Methods

__construct(
string $filename, string $delimiter
=
',', string $enclosure
=
'', bool $deleteFile
=
true, $checkUploadPath
=
TRUE
)
:
voidConstructor
| Name | Type | Description |
|---|---|---|
| $filename | string | |
| $delimiter | string | |
| $enclosure | string | |
| $deleteFile | bool | |
| $checkUploadPath |

__get(
$var
)
:
void| Name | Type | Description |
|---|---|---|
| $var |

fileExists(
)
:
boolReturns true if the filename given exists and is readable
| Type | Description |
|---|---|
| bool |

formatErrorMessage(
$error, $fieldName, $fieldValue
)
:
void| Name | Type | Description |
|---|---|---|
| $error | ||
| $fieldName | ||
| $fieldValue |

getFieldCount(
)
:
intReturns the number of fields in the current row
| Type | Description |
|---|---|
| int | count of fiels in the current row |

getNextRow(
)
:
arrayGets the next row from $_importFile
| Type | Description |
|---|---|
| array | current row of file |

getNumberOfLinesInfile(
)
:
intDetermine the number of lines in this file.
| Type | Description |
|---|---|
| int |

getTotalRecordCount(
)
:
intReturn the total count of records that will be imported.
| Type | Description |
|---|---|
| int |

loadDataSet(
$totalItems
=
0
)
:
voidReturn a result set from the external source as an associative array with the key value equal to the external field name and the rvalue equal to the actual value.
| Name | Type | Description |
|---|---|---|
| $totalItems |

markRowAsDuplicate(
$field_names
=
array()
)
:
voidWrites the row out to the ImportCacheFiles::getDuplicateFileName() file
Inherited from: \ImportDataSource::markRowAsDuplicate()| Name | Type | Description |
|---|---|---|
| $field_names |

markRowAsImported(
\$createdRecord $createdRecord
=
true
)
:
voidMarks whether this row created a new record or not
Inherited from: \ImportDataSource::markRowAsImported()| Name | Type | Description |
|---|---|---|
| $createdRecord | \$createdRecord | bool true if record is created, false if it is just updated |

setFpAfterBOM(
)
:
voidRemove the BOM (Byte Order Mark) from the beginning of the import row if it exists

writeError(
\$error $error, \$fieldName $fieldName, \$fieldValue $fieldValue
)
:
voidWrites the row out to the ImportCacheFiles::getErrorFileName() file
Inherited from: \ImportDataSource::writeError()| Name | Type | Description |
|---|---|---|
| $error | \$error | string |
| $fieldName | \$fieldName | string |
| $fieldValue | \$fieldValue | mixed |

writeErrorRecord(
$errorMessage
=
''
)
:
voidWrites the row out to the ImportCacheFiles::getErrorRecordsFileName() file
Inherited from: \ImportDataSource::writeErrorRecord()| Name | Type | Description |
|---|---|---|
| $errorMessage |

writeRowToLastImport(
string $import_module, string $module, string $id
)
:
voidAdd this row to the UsersLastImport table
Inherited from: \ImportDataSource::writeRowToLastImport()| Name | Type | Description |
|---|---|---|
| $import_module | string | name of the module we are doing the import into |
| $module | string | name of the bean we are creating for this import |
| $id | string | id of the recorded created in the $module |

writeStatus(
)
:
voidWrites the totals and filename out to the ImportCacheFiles::getStatusFileName() file
Inherited from: \ImportDataSource::writeStatus()