Version: current

# Class CsvBulkLoader

Uses the fgetcsv() function to process CSV input. The input is expected to be UTF8.

  Object
  ViewableData implements IteratorAggregate
  BulkLoader
  CsvBulkLoader

### Direct known subclasses

`GroupCsvBulkLoader`, `MemberCsvBulkLoader`

Package: cms\bulkloading
Author: Ingo Schommer, Silverstripe Ltd. (<myfirstname>@silverstripe.com)
See: http://rfc.net/rfc4180.html
Located at sapphire/dev/CsvBulkLoader.php

## Methods summary

`protected `BulkLoader_Result`` | # `processAll( string $filepath, boolean $preview = false )` Process every record in the file Process every record in the file #### Parameters $filepath string $filepath Absolute path to the file we're importing (with UTF8 content) $preview boolean $preview If true, we'll just output a summary of changes but not actually do anything #### Returns ``BulkLoader_Result`` A collection of objects which are either created, updated or deleted. 'message': free-text string that can optionally provide some more information about what changes have
`protected` | # `processRecord( array $record, array $columnMap, mixed & $results, boolean $preview = false )` #### Parameters $record array $record An map of the data, keyed by the header field defined in `BulkLoader::$columnMap` $columnMap array $columnMap $results $result BulkLoader_Result (passed as reference) $preview boolean $preview
`public unknown` | # `findExistingObject( array $record )` Find an existing objects based on one or more uniqueness columns specified via `BulkLoader::$duplicateChecks` Find an existing objects based on one or more uniqueness columns specified via `BulkLoader::$duplicateChecks` #### Parameters $record array $record CSV data column #### Returns `unknown` unknown
`public boolean` | # `hasHeaderRow( )` Determine wether any loaded files should be parsed with a header-row (otherwise we rely on `BulkLoader::$columnMap`. Determine wether any loaded files should be parsed with a header-row (otherwise we rely on `BulkLoader::$columnMap`. #### Returns `boolean` boolean

### Methods inherited from BulkLoader

`Title()`, `__construct()`, `getImportSpec()`, `getOptionFields()`, `isNullValue()`, `load()`, `preview()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public string` | $delimiter | # Delimiter character (Default: comma). Delimiter character (Default: comma).
`public string` | $enclosure | # Enclosure character (Default: doublequote) Enclosure character (Default: doublequote)
`public boolean` | $hasHeaderRow | # Identifies if the has a header row. Identifies if the has a header row.

### Properties inherited from BulkLoader

`$columnMap`, `$deleteExistingRecords`, `$duplicateChecks`, `$objectClass`, `$relationCallbacks`, `$title`

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -