Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,18 @@ public function getDataModel()

Based on interface, calls all SETTERS with given data to fill data object

[Api\DataObjectHelper::populateWithArray](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Api/DataObjectHelper.php#L80)
[Api\DataObjectHelper::populateWithArray](https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/Api/DataObjectHelper.php#L80)
- calls data object SETTERS `set*`, `setIs*` with given raw data
- handles `custom_attributes` - data object.setCustomAttribute


Example: [Magento\Customer\Controller\Account\Edit::execute](https://github.com/magento/magento2/blob/2.3/app/code/Magento/Customer/Controller/Account/Edit.php#L78)

## buildOutputDataArray

Based on given interface, calls all GETTERS to make resulting data array.

[Reflection\DataObjectProcessor::buildOutputDataArray](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php#L72):
[Reflection\DataObjectProcessor::buildOutputDataArray](https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php#L81):
- \Magento\Framework\Reflection\MethodsMap::getMethodsMap - method name and getter return types
- filter only getters: is..., has..., get...
- get data using interface getter, e.g. $object->getSku() - based on Interface definition
Expand All @@ -125,3 +127,5 @@ Based on given interface, calls all GETTERS to make resulting data array.
- process return object: build return value objects with their return type annotation
- process return array: cast each element to type, e.g. int[] => (int) each value
- cast element to type

Example: [Magento\Customer\Model\Address::updateData](https://github.com/magento/magento2/blob/2.3/app/code/Magento/Customer/Model/Address.php#L145)