CSItemApiItemMultiValueSetter
in package
This class is designed to update multiple values for multiple Items.
The array should look like the following (basically like an array returned by ):
array(
[ItemID1 / ExternalKey1] => array(
[ConfigurationID1] => [Value1],
[ConfigurationID2] => [Value2],
...
),
[ItemID2 / ExternalKey2] => array(
[ConfigurationID1] => [Value1],
[ConfigurationID3] => [Value3],
...
),
...
)
You can also pass an array of ConfigurationIDs/Value pairs to update only the current Item
Tags
Table of Contents
- __construct() : mixed
- This method is used to set all necessary properties needed for update
- addValue() : mixed
- This method adds / overwrites a value to the array containing the values to be updated
- addValues() : mixed
- This method adds a new array of values which gets merged to the array containing the values to be updated.
- getAllowInheritance() : bool
- This method returns whether the result from the parent node should be returned if no value is found for an item.
- getDoPreflight() : bool
- This method returns FALSE if all values will be set whether they have changed or not.
- getIgnoreWhitespaces() : bool
- This method returns whether the whitespaces will be trimmed for compare (TRUE) or not (FALSE).
- getItem() : CSItemApiItem
- This method returns the current Item the setValues method is called upon.
- getLoadIDFromExternalKey() : bool
- This method returns whether the value updates are searching for ExternalKeys (TRUE) instead of item ids (FALSE).
- getValues() : array<string|int, mixed>
- This method returns an array containing the values to be updated
- setAllowInheritance() : mixed
- This method sets whether the result from the parent node should be returned if no value is found for an item.
- setDoPreflight() : mixed
- This method sets if all values will be set whether they have changed or not.
- setIgnoreWhitespaces() : mixed
- This method sets whether the whitespaces will be trimmed for compare or not.
- setItem() : mixed
- This method sets the current Item the setValues method is called upon.
- setLoadIDFromExternalKey() : mixed
- This method sets whether the value updates are searching for ExternalKeys (TRUE) instead of item ids (FALSE).
- setValues() : bool
- This method sets new values for multiple items.
Methods
__construct()
This method is used to set all necessary properties needed for update
public
__construct(CSItemApiItem $oItem, array<string|int, mixed> $aValues[, int $iLanguageID = NULL ][, bool $bLoadIDFromExternalKey = FALSE ][, bool $bDoPreflight = TRUE ][, bool $bAllowInheritance = TRUE ][, bool $bIgnoreWhitespaces = TRUE ]) : mixed
Parameters
- $oItem : CSItemApiItem
-
The current Item the method is called upon. may be needed to only check its children if $bLoadIDFromExternalKey is TRUE
- $aValues : array<string|int, mixed>
-
An array containing the values to be updated
- $iLanguageID : int = NULL
-
The language id which should be updated as integer
- $bLoadIDFromExternalKey : bool = FALSE
-
Whether the value updates are searching for ExternalKeys instead of item ids
- $bDoPreflight : bool = TRUE
-
If set to FALSE all values will be set wether they have changed or not (CAUTION: disabling the preflight option costs Performance!!!)
- $bAllowInheritance : bool = TRUE
-
Whether the result from the parent node should be returned if no value is found for an item
- $bIgnoreWhitespaces : bool = TRUE
-
If set to TRUE the whitespaces will be trimmed for compare (only applies if $bDoPreflight is TRUE)
Tags
Return values
mixed —addValue()
This method adds / overwrites a value to the array containing the values to be updated
public
addValue(mixed $mItemID, mixed $mConfigurationID, mixed $mValue) : mixed
Parameters
- $mItemID : mixed
-
The item id or external key (depending on the LoadIDFromExternalKey parameter) of the item where the value should be added
- $mConfigurationID : mixed
-
The configuration id or name of the value which should be added to the set values array
- $mValue : mixed
-
The value which should be added to the set values array
Tags
Return values
mixed —addValues()
This method adds a new array of values which gets merged to the array containing the values to be updated.
public
addValues(array<string|int, mixed> $aValuesToAdd, mixed $mItemIDField) : mixed
The passed values array represents a csv line of an CONTENTSERV export. The item id or external key for the value update is searched in the single csv lines array, if the current line didn't contain the passed key for the item id or external key an error is thrown.
Parameters
- $aValuesToAdd : array<string|int, mixed>
-
An array of values which should be added to the set values array. The array should look like the following:
array( 0 => array( 'Label' => [Value1], 'ExternalKey' => [Value2], 135 => [Value3] ), 1 => array( [ConfigurationID1] => [Value1] ) ) - $mItemIDField : mixed
-
The name of the column containing the item id or external key
Tags
Return values
mixed —getAllowInheritance()
This method returns whether the result from the parent node should be returned if no value is found for an item.
public
getAllowInheritance() : bool
Tags
Return values
bool —getDoPreflight()
This method returns FALSE if all values will be set whether they have changed or not.
public
getDoPreflight() : bool
Tags
Return values
bool —getIgnoreWhitespaces()
This method returns whether the whitespaces will be trimmed for compare (TRUE) or not (FALSE).
public
getIgnoreWhitespaces() : bool
(only applies if $bDoPreflight is TRUE)
Tags
Return values
bool —getItem()
This method returns the current Item the setValues method is called upon.
public
getItem() : CSItemApiItem
Tags
Return values
CSItemApiItem —getLoadIDFromExternalKey()
This method returns whether the value updates are searching for ExternalKeys (TRUE) instead of item ids (FALSE).
public
getLoadIDFromExternalKey() : bool
Tags
Return values
bool —getValues()
This method returns an array containing the values to be updated
public
getValues() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array containing the values to be updated
setAllowInheritance()
This method sets whether the result from the parent node should be returned if no value is found for an item.
public
setAllowInheritance(bool $bAllowInheritance) : mixed
Parameters
- $bAllowInheritance : bool
-
Whether the result from the parent node should be returned if no value is found for an item
Tags
Return values
mixed —setDoPreflight()
This method sets if all values will be set whether they have changed or not.
public
setDoPreflight(bool $bDoPreflight) : mixed
Parameters
- $bDoPreflight : bool
-
If set to FALSE all values will be set whether they have changed or not (CAUTION: disabling the preflight option costs Performance!!!)
Tags
Return values
mixed —setIgnoreWhitespaces()
This method sets whether the whitespaces will be trimmed for compare or not.
public
setIgnoreWhitespaces(bool $bIgnoreWhitespaces) : mixed
Parameters
- $bIgnoreWhitespaces : bool
-
If set to TRUE the whitespaces will be trimmed for compare (only applies if $bDoPreflight is TRUE)
Tags
Return values
mixed —setItem()
This method sets the current Item the setValues method is called upon.
public
setItem(CSItemApiItem $oItem) : mixed
Parameters
- $oItem : CSItemApiItem
-
The current Item the setValues method is called upon. may be needed to only check its children if $bLoadIDFromExternalKey is TRUE
Tags
Return values
mixed —setLoadIDFromExternalKey()
This method sets whether the value updates are searching for ExternalKeys (TRUE) instead of item ids (FALSE).
public
setLoadIDFromExternalKey(bool $bLoadIDFromExternalKey) : mixed
Parameters
- $bLoadIDFromExternalKey : bool
-
Whether the value updates are searching for ExternalKeys instead of item ids
Tags
Return values
mixed —setValues()
This method sets new values for multiple items.
public
setValues() : bool
Tags
Return values
bool —TRUE if all values could be set
