Skip to content

Commit 9c4407a

Browse files
committed
Merge remote-tracking branch 'origin/1.10' into 2.0
2 parents 7010b7e + 685c7c1 commit 9c4407a

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

doc/03_Configuration/06_Mapping_Configuration/02_Transformation_Pipeline.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ Their name is usually prefixed with `As`.
3535
input quanitity value, expects first item in array to be value, second item in array to be unit id.
3636
- **As Input Quantity Value Array**: Same like `As Input Quantity Value`, but for arrays of values. Expects an array
3737
with sub-arrays where first item to be value and second item to be unit id each and results in an array of quantity value objects.
38-
- **As Numeric**: Converts data to a numeric by using `floatval`.
38+
- **As Numeric**: Converts data to a numeric with type casting.
39+
- `Return null if empty` option:
40+
41+
| Input | Output |
42+
| ------- | ---------- |
43+
| 1234 | 1234 |
44+
| String | --EMPTY-- |
45+
| | --EMPTY-- |
46+
| 0 | 0 |
3947
- **As Quantity Value**: Converts an array to a quantity value object for
4048
quanitity value, expects first item in array to be value, second item in array to be unit id.
4149
- **As Quantity Value Array**: Same like `As Quantity Value`, but for arrays of values. Expects an array

src/Mapping/DataTarget/Direct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ protected function checkAssignData($newData, $valueContainer, $getter)
149149
$fieldName = $fieldNameParts[2];
150150
}
151151

152-
if ($this->fieldName === 'key') {
152+
if ($this->fieldName === 'key' || $this->fieldName === 'type') {
153153
$currentDataIsEmpty = empty($currentData);
154154
$newDataIsEmpty = empty($newData);
155155
} else {

src/Mapping/Operator/Factory/Numeric.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public function process($inputData, bool $dryRun = false)
3232
$inputData = reset($inputData);
3333
}
3434

35-
$floatValue = floatval($inputData);
35+
$floatValue = (float) $inputData;
3636

37-
if ($this->returnNullIfEmpty && empty($floatValue)) {
37+
if ($this->returnNullIfEmpty && !is_numeric($inputData) && $floatValue === 0.0) {
3838
return null;
3939
}
4040

@@ -65,7 +65,7 @@ public function evaluateReturnType(string $inputType, ?int $index = null): strin
6565
*/
6666
public function generateResultPreview($inputData)
6767
{
68-
if ($this->returnNullIfEmpty && empty($inputData)) {
68+
if ($this->returnNullIfEmpty && !is_numeric($inputData)) {
6969
return null;
7070
}
7171

src/Processing/ImportProcessingService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ protected function processElement(string $configName, array $importDataRow, Reso
256256
'fileObject' => new FileObject(json_encode($importDataRow))
257257
]);
258258
}
259-
} catch (\Exception | \TypeError $e) {
259+
} catch (\Throwable $e) {
260260
$message = "Error processing element: {$importDataRowString}";
261261
$this->logger->error($message . $e);
262262

0 commit comments

Comments
 (0)