コード例 #1
0
ファイル: Converter.php プロジェクト: pavelnovitsky/magento2
 /**
  * Loads the values from a customer model
  *
  * @param Customer $customerModel
  * @return CustomerDataObjectBuilder
  */
 protected function _populateBuilderWithAttributes(Customer $customerModel)
 {
     $attributes = array();
     foreach ($customerModel->getAttributes() as $attribute) {
         $attrCode = $attribute->getAttributeCode();
         $value = $customerModel->getDataUsingMethod($attrCode);
         $value = $value ? $value : $customerModel->getData($attrCode);
         if (null !== $value) {
             if ($attrCode == 'entity_id') {
                 $attributes[CustomerDataObject::ID] = $value;
             } else {
                 $attributes[$attrCode] = $value;
             }
         }
     }
     return $this->_customerBuilder->populateWithArray($attributes);
 }