Skip to content

Commit

Permalink
Fix DefaultValue handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Neuhaus committed Feb 21, 2018
1 parent 1962edb commit 8712b7c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Classes/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function mapPropertyValueToObject($propertyName, $propertyValue, $obje
}
}
$propertyValue = $objectStorage;
} else {
} elseif ($propertyValue !== null) {
$sourceType = $propertyMapper->determineSourceType($propertyValue);
if ($targetType !== $sourceType) {
if ($targetType === 'string' && $sourceType === 'array') {
Expand Down Expand Up @@ -352,6 +352,8 @@ protected function addMissingNullProperties($properties, Module $module)
if (!isset($properties[$field['name']])) {
$value = '';
if (isset($field['defaultValue'])) {
$value = $field['defaultValue'];
} else {
switch ($field['type']) {
case 'CEVarchar':
$value = '';
Expand All @@ -369,21 +371,20 @@ protected function addMissingNullProperties($properties, Module $module)
break;
case 'CETimestamp':
case 'CEInteger':
case 'CELong':
case 'MAMNumber':
case 'XMPNumber':
$value = 0;
break;
case 'MAMList':
case 'CEVarcharList':
$value = [];
break;
case 'FIELD_LINK':
case 'CEExternalIdList':
case 'CEIdList':
case 'MANY_TO_MANY':
case 'ONE_TO_MANY':
case 'MANY_TO_ONE':
$value = null;
$value = [];
break;
case 'CEId':
case 'CEExternalId':
Expand Down

0 comments on commit 8712b7c

Please sign in to comment.