All Data Structures Functions Variables Pages
Static Public Member Functions | Static Protected Member Functions
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, $explicitReadWriteModelPermissions=null)
 
static getAttributeImportRules (ImportRules $importRules, $columnMappingData, $explicitReadWriteModelPermissions=null)
 
static processImportInformationForAttributeDataAndPopulateModel (ImportRules $importRules, $columnName, $columnMappingData, $rowBean, ImportSanitizeResultsUtil $importSanitizeResultsUtil, RedBeanModel $model, &$afterSaveActionsData, $explicitReadWriteModelPermissions=null)
 
static processDedupeAttributesToCheckForSkipIfRequired (ImportRules $importRules, RedBeanModel $model, $mappingData, $rowBean, ImportRowDataResultsUtil $importRowDataResultsUtil, ImportSanitizeResultsUtil $importSanitizeResultsUtil, &$skippedColumns, $explicitReadWriteModelPermissions=null)
 

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
ImportRules$importRules
RedBean_OODBBean$rowBean
array$mappingData
ImportRowDataResultsUtil$importRowDataResultsUtil
ExplicitReadWriteModelPermissions$explicitReadWriteModelPermissions
Exceptions
NotSupportedException

Definition at line 89 of file ImportUtil.php.

static resolveLinkMessageToModel ( RedBeanModel  $model)
static

Public for testing only

Parameters
RedBeanModel$model
Returns
string

Definition at line 283 of file ImportUtil.php.

static getMappedColumnNameByMappingData (   $modelColumnName,
  $mappingData 
)
staticprotected

Get mapped column name by mapping data

Parameters
string$modelColumnName
array$mappingData
Returns
boolean
Exceptions
NotSupportedException

Definition at line 368 of file ImportUtil.php.

static resolveAfterSaveActionDerivedAttributeImportRules ( $afterSaveActionsData,
DerivedAttributeImportRules  $attributeImportRules,
  $attributeValueData 
)
staticprotected

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 448 of file ImportUtil.php.

static resolveAfterSaveActionNonDerivedAttributeImportRules ( $afterSaveActionsData,
NonDerivedAttributeImportRules  $attributeImportRules,
  $attributeValueData 
)
staticprotected

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 473 of file ImportUtil.php.

static runFromImportCommand (   $args)
static

Method to run import from command line. Use .

Parameters
array$args

Definition at line 559 of file ImportUtil.php.

static getPenultimateModelClassNameByImportRules ( ImportRules  $importRules)
static

Get Penultimate ModelClassName By Import Rules

Parameters
ImportRules$importRules
Returns
mixed

Definition at line 609 of file ImportUtil.php.

static getAttributeValueData ( ImportRules  $importRules,
  $columnName,
  $columnMappingData,
  $rowBean,
ImportSanitizeResultsUtil  $importSanitizeResultsUtil,
  $explicitReadWriteModelPermissions = null 
)
staticprotected

Gets attribute value data

Parameters
ImportRules$importRules
string$columnName
array$columnMappingData
RedBean_OODBBean$rowBean
ImportSanitizeResultsUtil$importSanitizeResultsUtil
null|| ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
Returns
mixed
Exceptions
NotSupportedException

Definition at line 626 of file ImportUtil.php.

static getAttributeImportRules ( ImportRules  $importRules,
  $columnMappingData,
  $explicitReadWriteModelPermissions = null 
)
staticprotected

Get attribute import rules

Parameters
ImportRules$importRules
array$columnMappingData
null|| ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
Returns
object containing attribute import rules
Exceptions
NotSupportedException

Definition at line 650 of file ImportUtil.php.

static processImportInformationForAttributeDataAndPopulateModel ( ImportRules  $importRules,
  $columnName,
  $columnMappingData,
  $rowBean,
ImportSanitizeResultsUtil  $importSanitizeResultsUtil,
RedBeanModel  $model,
$afterSaveActionsData,
  $explicitReadWriteModelPermissions = null 
)
staticprotected
Parameters
ImportRules$importRules
string$columnName
array$columnMappingData
RedBean_OODBBean$rowBean
ImportSanitizeResultsUtil$importSanitizeResultsUtil
RedBeanModel$model
$afterSaveActionsData
null|| ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions

Definition at line 675 of file ImportUtil.php.

static processDedupeAttributesToCheckForSkipIfRequired ( ImportRules  $importRules,
RedBeanModel  $model,
  $mappingData,
  $rowBean,
ImportRowDataResultsUtil  $importRowDataResultsUtil,
ImportSanitizeResultsUtil  $importSanitizeResultsUtil,
$skippedColumns,
  $explicitReadWriteModelPermissions = null 
)
staticprotected

Process mapped columns to check for matched record by column

Parameters
ImportRules$importRules
RedBeanModel$model
array$mappingData
RedBean_OODBBean$rowBean
ImportRowDataResultsUtil$importRowDataResultsUtil
ImportSanitizeResultsUtil$importSanitizeResultsUtil
array$skippedColumns
null|| ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
Returns
bool
Exceptions
NotSupportedException

Definition at line 711 of file ImportUtil.php.


The documentation for this class was generated from the following file:
Generated on Mon Feb 24 2020 07:10:45