Detailed Description

CSVImportController imports instances of one type into the storage.

It uses the fgetcsv function of PHP with the default values for delimiter, enclosing and escape character.

The controller supports the following actions:

Action default
Initiate the import.
Parameter Description
in docFile The file upload as associative array with the following keys: 'name', 'type', 'tmp_name' (typically a $_FILES entry)
in className The entity type to import instances of
in nodesPerCall The number of nodes to process in one call (default: 50)

For additional actions and parameters see BatchController actions.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 54 of file CSVImportController.php.

+ Inheritance diagram for CSVImportController:

Public Member Functions

 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration, Cache $staticCache)
 
 initialize (Request $request, Response $response)
 
- Public Member Functions inherited from Controller
 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
 
 execute ($method=null)
 
 getRequest ()
 
 getResponse ()
 

Public Attributes

const CACHE_KEY_STATS = 'stats'
 
const NODES_PER_CALL = 50
 
- Public Attributes inherited from BatchController
const REQUEST_VAR = 'request'
 
const ONE_CALL_VAR = 'oneCall'
 
const STEP_VAR = 'step'
 
const NUM_STEPS_VAR = 'numSteps'
 
const DOWNLOAD_STEP_VAR = 'downloadStep'
 
const PACKAGES_VAR = 'packages'
 
- Public Attributes inherited from Controller
const CSRF_TOKEN_PARAM = 'csrf_token'
 

Protected Member Functions

 validate ()
 
 getWorkPackage ($number)
 
 initImport ($oids)
 
 importNodes ($oids)
 
 cleanup ()
 
- Protected Member Functions inherited from BatchController
 doExecute ($method=null)
 
 getStepNumber ()
 
 addWorkPackage ($name, $size, array $oids, $callback, $args=null)
 
 processPart ($step)
 
 getRequestValue ($name)
 
 getNumberOfSteps ()
 
 getDisplayText ($step)
 
 getDownloadFile ()
 
- Protected Member Functions inherited from Controller
 executeSubAction ($action)
 
 redirect ($location, $key=null, $data=null)
 
 getLogger ()
 
 getSession ()
 
 getPersistenceFacade ()
 
 getPermissionManager ()
 
 getActionMapper ()
 
 getLocalization ()
 
 getMessage ()
 
 getConfiguration ()
 
 requireTransaction ()
 
 endTransaction ($commit)
 
 isLocalizedRequest ()
 
 checkLanguageParameter ()
 
 generateCsrfToken ($name, $refresh=true)
 
 validateCsrfToken ($name, $invalidate=true)
 
 getLocalSessionValue ($key, $default=null)
 
 setLocalSessionValue ($key, $value)
 
 clearLocalSessionValues ()
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Session  $session,
PersistenceFacade  $persistenceFacade,
PermissionManager  $permissionManager,
ActionMapper  $actionMapper,
Localization  $localization,
Message  $message,
Configuration  $configuration,
Cache  $staticCache 
)

Constructor.

Parameters
$session
$persistenceFacade
$permissionManager
$actionMapper
$localization
$message
$configuration
$staticCache

Definition at line 73 of file CSVImportController.php.

Member Function Documentation

◆ initialize()

initialize ( Request  $request,
Response  $response 
)
See also
Controller::initialize()

Reimplemented from BatchController.

Definition at line 90 of file CSVImportController.php.

◆ validate()

validate ( )
protected
See also
Controller::validate()

Reimplemented from Controller.

Definition at line 131 of file CSVImportController.php.

◆ getWorkPackage()

getWorkPackage (   $number)
protected
See also
BatchController::getWorkPackage()

Reimplemented from BatchController.

Definition at line 161 of file CSVImportController.php.

◆ initImport()

initImport (   $oids)
protected

Initialize the CSV import (object ids parameter will be ignored)

Parameters
$oidsThe object ids to process
Note
This is a callback method called on a matching work package, see BatchController::addWorkPackage()

Definition at line 173 of file CSVImportController.php.

◆ importNodes()

importNodes (   $oids)
protected

Serialize all Nodes with given object ids to CSV.

Parameters
$oidsThe object ids to process
Note
This is a callback method called on a matching work package, see BatchController::addWorkPackage()

Definition at line 211 of file CSVImportController.php.

◆ cleanup()

cleanup ( )
protected
See also
BatchController::cleanup()

Reimplemented from BatchController.

Definition at line 295 of file CSVImportController.php.

Member Data Documentation

◆ CACHE_KEY_STATS

const CACHE_KEY_STATS = 'stats'

Definition at line 55 of file CSVImportController.php.

◆ NODES_PER_CALL

const NODES_PER_CALL = 50

Definition at line 58 of file CSVImportController.php.