ImportUtil Class Reference

Static Public Member Functions

static importByDataProvider (ImportDataProvider $dataProvider, ImportRules $importRules, $mappingData, ImportResultsUtil $importResultsUtil, ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions, ImportMessageLogger $messageLogger)
static importByImportRulesRowData (ImportRules $importRules, $rowBean, $mappingData, ImportRowDataResultsUtil $importRowDataResultsUtil, ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions)
static resolveLinkMessageToModel (RedBeanModel $model)
static runFromImportCommand ($args)
static getPenultimateModelClassNameByImportRules (ImportRules $importRules)

Static Protected Member Functions

static sanitizeValueAndPopulateModel (ImportRules $importRules, RedBeanModel $model, $columnMappingData, $attributeValueData, &$afterSaveActionsData)
static processAfterSaveActions ($afterSaveActionsData, RedBeanModel $model)
static getMappedColumnNameByMappingData ($modelColumnName, $mappingData)
static resolveModelForAttributeIndexWithMultipleNonDerivedAttributes (RedBeanModel $model, $attributeImportRules, $attributeValueData, $columnMappingData)
static resolveModelForAttributeIndexWithSingleAttributeOrDerivedAttribute (RedBeanModel $model, $attributeValueData)
static resolveAfterSaveActionDerivedAttributeImportRules (&$afterSaveActionsData, DerivedAttributeImportRules $attributeImportRules, $attributeValueData)
static resolveAfterSaveActionNonDerivedAttributeImportRules (&$afterSaveActionsData, NonDerivedAttributeImportRules $attributeImportRules, $attributeValueData)
static resolveModelForModelDerivedAttribute (RedBeanModel $model, $importRulesType, AttributeImportRules $attributeImportRules, $attributeValueData)
static resolveReadOnlyAndSetValueToAttribute (RedBeanModel $model, $attributeName, $value)
static resolveValueThatIsManyModelsRelationToAttribute ($model, $attributeName, $value)
static resolveValueToSanitizeByValueAndColumnType ($value, $columnType)
static resolveValueToSanitize ($value)
static getAttributeValueData (ImportRules $importRules, $columnName, $columnMappingData, $rowBean, ImportSanitizeResultsUtil $importSanitizeResultsUtil)
static getAttributeImportRules (ImportRules $importRules, $columnMappingData)
static processImportInformationForAttributeDataAndPopulateModel (ImportRules $importRules, $columnName, $columnMappingData, $rowBean, ImportSanitizeResultsUtil $importSanitizeResultsUtil, RedBeanModel $model, &$afterSaveActionsData)
static processDedupeAttributesToCheckForSkipIfRequired (ImportRules $importRules, RedBeanModel $model, $mappingData, $rowBean, ImportRowDataResultsUtil $importRowDataResultsUtil, ImportSanitizeResultsUtil $importSanitizeResultsUtil, &$skippedColumns)

Detailed Description

Helper class for working with import.

Definition at line 40 of file ImportUtil.php.


Member Function Documentation

static importByDataProvider ( ImportDataProvider dataProvider,
ImportRules importRules,
mappingData,
ImportResultsUtil importResultsUtil,
ExplicitReadWriteModelPermissions explicitReadWriteModelPermissions,
ImportMessageLogger messageLogger 
) [static]

Given a data provider, call getData and for each row, attempt to import the data.

Parameters:
ImportDataProvider $dataProvider
ImportRules $importRules
$mappingData 
ImportResultsUtil $importResultsUtil
ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
ImportMessageLogger $messageLogger

Definition at line 51 of file ImportUtil.php.

static importByImportRulesRowData ( ImportRules importRules,
rowBean,
mappingData,
ImportRowDataResultsUtil importRowDataResultsUtil,
ExplicitReadWriteModelPermissions explicitReadWriteModelPermissions 
) [static]

Given a row of data, resolve each value of the row for import and either create or update an existing model.

Parameters:
object $importRules
array $rowData
array $mappingData
object $importRowDataResultsUtil

Definition at line 87 of file ImportUtil.php.

static resolveLinkMessageToModel ( RedBeanModel model  )  [static]

Public for testing only

Parameters:
RedBeanModel $model
Returns:
string

Definition at line 275 of file ImportUtil.php.

static getMappedColumnNameByMappingData ( modelColumnName,
mappingData 
) [static, protected]

Get mapped column name by mapping data

Parameters:
string $modelColumnName
array $mappingData
Returns:
boolean
Exceptions:
NotSupportedException 

Definition at line 360 of file ImportUtil.php.

static resolveAfterSaveActionDerivedAttributeImportRules ( &$  afterSaveActionsData,
DerivedAttributeImportRules attributeImportRules,
attributeValueData 
) [static, protected]

Some derivedAttributeImportRules require the sanitized values to be processed after the model is saved. An example is the user status which is a derived attribute requiring processing after the user has been saved. This method gets the sanitized value and adds it along with the attributeImportRules class name to an array by reference. After the model is saved, this array is referenced and each attribute import rule is processed.

See also:
AfterSaveActionDerivedAttributeImportRules
Parameters:
array $afterSaveActionsData
AttributeImportRules $attributeImportRules
mixed $valueReadyToSanitize
array $columnMappingData
ImportSanitizeResultsUtil $importSanitizeResultsUtil

Definition at line 440 of file ImportUtil.php.

static resolveAfterSaveActionNonDerivedAttributeImportRules ( &$  afterSaveActionsData,
NonDerivedAttributeImportRules attributeImportRules,
attributeValueData 
) [static, protected]

Some attributeImportRules require the sanitized values to be processed after the model is saved. An example is the user status which is a derived attribute requiring processing after the user has been saved. This method gets the sanitized value and adds it along with the attributeImportRules class name to an array by reference. After the model is saved, this array is referenced and each attribute import rule is processed.

See also:
AfterSaveActionNonDerivedAttributeImportRules
Parameters:
array $afterSaveActionsData
AttributeImportRules $attributeImportRules
mixed $valueReadyToSanitize
array $columnMappingData
ImportSanitizeResultsUtil $importSanitizeResultsUtil

Definition at line 465 of file ImportUtil.php.

static runFromImportCommand ( args  )  [static]

Method to run import from command line. Use .

Parameters:
array $args

Definition at line 551 of file ImportUtil.php.

static getPenultimateModelClassNameByImportRules ( ImportRules importRules  )  [static]

Get Penultimate ModelClassName By Import Rules

Parameters:
type $importRules
Returns:
type

Definition at line 601 of file ImportUtil.php.

static getAttributeValueData ( ImportRules importRules,
columnName,
columnMappingData,
rowBean,
ImportSanitizeResultsUtil importSanitizeResultsUtil 
) [static, protected]

Gets attribute value data

Parameters:
AttributeImportRules $attributeImportRules
string $columnName
array $columnMappingData
string $valueReadyToSanitize
ImportSanitizeResultsUtil $importSanitizeResultsUtil

Definition at line 615 of file ImportUtil.php.

static getAttributeImportRules ( ImportRules importRules,
columnMappingData 
) [static, protected]

Get attribute import rules

Parameters:
ImportRules $importRules
array $columnMappingData
Returns:
object containing attribute import rules
Exceptions:
NotSupportedException 

Definition at line 638 of file ImportUtil.php.

static processImportInformationForAttributeDataAndPopulateModel ( ImportRules importRules,
columnName,
columnMappingData,
rowBean,
ImportSanitizeResultsUtil importSanitizeResultsUtil,
RedBeanModel model,
&$  afterSaveActionsData 
) [static, protected]

Process import information, get attribute value data and populates the model

Parameters:
ImportRules $importRules
string $columnName
array $columnMappingData
RedBean_OODBBean $rowBean
ImportSanitizeResultsUtil $importSanitizeResultsUtil
RedBeanModel $model
array $afterSaveActionsData

Definition at line 662 of file ImportUtil.php.

static processDedupeAttributesToCheckForSkipIfRequired ( ImportRules importRules,
RedBeanModel model,
mappingData,
rowBean,
ImportRowDataResultsUtil importRowDataResultsUtil,
ImportSanitizeResultsUtil importSanitizeResultsUtil,
&$  skippedColumns 
) [static, protected]

Process mapped columns to check for matched record by column

Parameters:
ImportRules $importRules
RedBeanModel $model
array $mappingData
RedBean_OODBBean $rowBean
ImportSanitizeResultsUtil $importSanitizeResultsUtil
array $skippedColumns

Definition at line 692 of file ImportUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Fri Dec 15 07:10:26 2017