Skip to content

Commit

Permalink
Link url fix and examples have been added on 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cyildirim authored and unicoder88 committed Jan 19, 2020
1 parent b423ab5 commit 0ab4344
Showing 1 changed file with 6 additions and 2 deletions.
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)

0 comments on commit 0ab4344

Please sign in to comment.