Comments: on this page. Click to read or post your own.

Class CsvBulkLoader

Description

Uses the fgetcsv() function to process CSV input.

The input is expected to be UTF8.

  • author: Ingo Schommer, Silverstripe Ltd. (<myfirstname>@silverstripe.com)
  • see: http://rfc.net/rfc4180.html
  • todo: Support for deleting existing records not matched in the import (through relation checks)

Located in /sapphire/dev/CsvBulkLoader.php (line 13)

Object
   |
   --ViewableData
      |
      --BulkLoader
         |
         --CsvBulkLoader
Variable Summary
string $delimiter
string $enclosure
boolean $hasHeaderRow
Method Summary
unknown findExistingObject (array $record)
boolean hasHeaderRow ()
void processAll ( $filepath, [ $preview = false])
void processRecord ( $record,  $columnMap,  &$results, [ $preview = false])
Variables
string $delimiter = ',' (line 20)

Delimiter character (Default: comma).

  • access: public
string $enclosure = '"' (line 27)

Enclosure character (Default: doublequote)

  • access: public
boolean $hasHeaderRow = false (line 37)

Identifies if the has a header row.

If a self::$columnMap is passed, we assume the file has no headerrow, unless explicitly noted.

  • access: public

Inherited Variables

Inherited from BulkLoader

BulkLoader::$columnMap
BulkLoader::$duplicateChecks
BulkLoader::$objectClass
BulkLoader::$relationCallbacks
BulkLoader::$title

Inherited from ViewableData

ViewableData::$casting
ViewableData::$castingHelperPair_cache
ViewableData::$customisedObj
ViewableData::$failover
ViewableData::$iteratorPos
ViewableData::$iteratorTotalItems
ViewableData::$namedAs
ViewableData::$parent
ViewableData::$_natural_cache
ViewableData::$_object_cache
ViewableData::$_xml_cache

Inherited from Object

Object::$builtInMethods
Object::$class
Object::$classConstructed
Object::$extensions
Object::$extension_instances
Object::$extraMethods
Object::$extraStatics
Object::$statics
Object::$static_cached
Methods
findExistingObject (line 140)

Find an existing objects based on one or more uniqueness columns specified via self::$duplicateChecks

  • access: public
unknown findExistingObject (array $record)
  • array $record: CSV data column
hasHeaderRow (line 170)

Determine wether any loaded files should be parsed with a header-row (otherwise we rely on self::$columnMap.

  • access: public
boolean hasHeaderRow ()
processAll (line 39)
  • access: protected
void processAll ( $filepath, [ $preview = false])
  • $filepath
  • $preview

Redefinition of:
BulkLoader::processAll()
Process every record in the file
processRecord (line 61)
  • todo: Better messages for relation checks and duplicate detection Note that columnMap isn't used
  • access: protected
void processRecord ( $record,  $columnMap,  &$results, [ $preview = false])
  • $record
  • $columnMap
  • &$results
  • $preview

Redefinition of:
BulkLoader::processRecord()
Process a single record from the file.

Inherited Methods

Inherited From BulkLoader

BulkLoader::__construct()
BulkLoader::getImportSpec()
BulkLoader::getOptionFields()
BulkLoader::isNullValue()
BulkLoader::load()
BulkLoader::preview()
BulkLoader::processAll()
BulkLoader::processRecord()
BulkLoader::Title()

Inherited From ViewableData

ViewableData::ATT_val()
ViewableData::BaseHref()
ViewableData::buildCastingHelperCache()
ViewableData::cachedCall()
ViewableData::castingHelper()
ViewableData::castingHelperPair()
ViewableData::castingObjectCreator()
ViewableData::castingObjectCreatorPair()
ViewableData::CSSClasses()
ViewableData::CurrentMember()
ViewableData::CurrentPage()
ViewableData::customise()
ViewableData::Debug()
ViewableData::defineMethods()
ViewableData::escapeTypeForField()
ViewableData::Even()
ViewableData::EvenOdd()
ViewableData::First()
ViewableData::FirstLast()
ViewableData::getField()
ViewableData::getIterator()
ViewableData::getXMLValues()
ViewableData::hasField()
ViewableData::HasPerm()
ViewableData::hasValue()
ViewableData::i18nLocale()
ViewableData::IsAjax()
ViewableData::iteratorProperties()
ViewableData::JS_val()
ViewableData::Last()
ViewableData::Me()
ViewableData::Middle()
ViewableData::MiddleString()
ViewableData::obj()
ViewableData::Odd()
ViewableData::Pos()
ViewableData::RAW_val()
ViewableData::renderWith()
ViewableData::SecurityID()
ViewableData::setCustomisedObj()
ViewableData::setField()
ViewableData::SQL_val()
ViewableData::ThemeDir()
ViewableData::Top()
ViewableData::TotalItems()
ViewableData::val()
ViewableData::XML_val()
ViewableData::__get()
ViewableData::__isset()
ViewableData::__set()

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:39:27 +1300 by phpDocumentor 1.3.2