Skip to content

Commit dd0c1bb

Browse files
authored
Allow Load object by calculated value. (#483)
* Allow Load object by calculated value. * allow read only calculated fields.
1 parent 8724f80 commit dd0c1bb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/Mapping/Type/TransformationDataTypeService.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class TransformationDataTypeService
6565

6666
const COUNTRY_ARRAY = 'countryArray';
6767

68+
const CALCULATED = 'calculated';
69+
6870
protected $transformationDataTypesMapping = [
6971
self::DEFAULT_TYPE => [
7072
'input',
@@ -78,7 +80,7 @@ class TransformationDataTypeService
7880
'firstname',
7981
'lastname',
8082
'email',
81-
'gender'
83+
'gender',
8284
],
8385
self::NUMERIC => [
8486
'numeric',
@@ -152,7 +154,10 @@ class TransformationDataTypeService
152154
],
153155
self::COUNTRY_ARRAY => [
154156
'countrymultiselect'
155-
]
157+
],
158+
self::CALCULATED =>[
159+
'calculatedValue'
160+
],
156161
];
157162

158163
public function appendTypeMapping(string $pimcoreDataType, string $transformationTargetType): void
@@ -235,6 +240,10 @@ public function getPimcoreDataTypes(string $classId, $transformationTargetType,
235240

236241
if (in_array(self::DEFAULT_TYPE, $transformationTargetType)) {
237242
if ($includeSystemRead) {
243+
// Allow reading from calculated fields
244+
foreach ($class->getFieldDefinitions() as $definition) {
245+
$this->addTypesToAttributesArray($definition, self::CALCULATED, $attributes);
246+
}
238247
$attributes['id'] = [
239248
'key' => 'id',
240249
'title' => 'SYSTEM ID',

0 commit comments

Comments
 (0)