Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Static Public Member Functions | |
static & | accumulateByMap ($from, $to, array $map, array $defaults=[]) |
@SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)
Definition at line 16 of file Mapper.php.
|
static |
Convert data from source to target item using map array
Will get or set data with generic or magic, or specified Magento Object methods, or with array keys from or to \Magento\Framework\DataObject or array :)
Map must either be associative array of keys from=>to or a numeric array of keys, assuming from = to
Defaults must be assoc array of keys => values. Target will get default, if the value is not present in source If the source has getter defined instead of magic method, the value will be taken only if not empty
Callbacks explanation (when $from or $to is not array): for $from: <\Magento\Framework\DataObject> => $from->getData($key) (default) array(<\Magento\Framework\DataObject>, <method>) => $from->$method($key) for $to (makes sense only for \Magento\Framework\DataObject): <\Magento\Framework\DataObject> => $from->setData($key, <from>) array(<\Magento\Framework\DataObject>, <method>) => $from->$method($key, <from>)
array | \Magento\Framework\DataObject | callback | $from | |
array | \Magento\Framework\DataObject | callback | $to | |
array | $map | |
array | $defaults |
Definition at line 45 of file Mapper.php.