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


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


$_currentRow= 'FALSE'
Array of the values in the current array we are in
Inherited from: \ImportDataSource::$$_currentRowFALSE
Details- 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.
null
Details- 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::$$_offset0
Details- 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::$$_rowCountedForErrorsfalse
Details- 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'
0
Details- Type
- n/a
- Inherited_from
- \ImportDataSource::$$_updatedCount
Methods


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


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


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


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


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


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


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


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


loadDataSet(
$totalItems
=
0
)
:
void
Return 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()
)
:
void
Writes the row out to the ImportCacheFiles::getDuplicateFileName() file
Inherited from: \ImportDataSource::markRowAsDuplicate()Name | Type | Description |
---|---|---|
$field_names |


markRowAsImported(
\$createdRecord $createdRecord
=
true
)
:
void
Marks 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(
)
:
void
Remove the BOM (Byte Order Mark) from the beginning of the import row if it exists


writeError(
\$error $error, \$fieldName $fieldName, \$fieldValue $fieldValue
)
:
void
Writes 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
=
''
)
:
void
Writes the row out to the ImportCacheFiles::getErrorRecordsFileName() file
Inherited from: \ImportDataSource::writeErrorRecord()Name | Type | Description |
---|---|---|
$errorMessage |


writeRowToLastImport(
string $import_module, string $module, string $id
)
:
void
Add 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(
)
:
void
Writes the totals and filename out to the ImportCacheFiles::getStatusFileName() file
Inherited from: \ImportDataSource::writeStatus()