Skip to content

Commit 86d18d2

Browse files
authored
Fix adding AdditionalPropertiesAccessorPostProcessor to a mutable object without an additional property definition breaks the rendering
1 parent 4d138b5 commit 86d18d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SchemaProcessor/PostProcessor/Templates/SetAdditionalProperty.phptpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Adds or overwrites an additional property on the object
33
*
44
* @param string $property The property key of the additional property
5-
* @param {{ viewHelper.getTypeHintAnnotation(validationProperty) }} $value The new value of the additional property
5+
* @param {% if validationProperty %}{{ viewHelper.getTypeHintAnnotation(validationProperty) }}{% else %}mixed{% endif %} $value The new value of the additional property
66
*
77
* @return self
88
*
@@ -11,7 +11,7 @@
1111
*/
1212
public function setAdditionalProperty(
1313
string $property,
14-
{{ viewHelper.getType(validationProperty) }} $value
14+
{% if validationProperty %}{{ viewHelper.getType(validationProperty) }}{% endif %} $value
1515
): self {
1616
if (in_array($property, {{ objectProperties }})) {
1717
throw new RegularPropertyAsAdditionalPropertyException($value, $property, self::class);
@@ -21,7 +21,7 @@ public function setAdditionalProperty(
2121
return $this;
2222
}
2323

24-
{{ schemaHookResolver.resolveSetterBeforeValidationHook(validationProperty) }}
24+
{% if validationProperty %}{{ schemaHookResolver.resolveSetterBeforeValidationHook(validationProperty) }}{% endif %}
2525

2626
{% if schema.getBaseValidators() %}
2727
{% if generatorConfiguration.collectErrors() %}
@@ -42,7 +42,7 @@ public function setAdditionalProperty(
4242

4343
$this->_rawModelDataInput[$property] = $value;
4444

45-
{{ schemaHookResolver.resolveSetterAfterValidationHook(validationProperty) }}
45+
{% if validationProperty %}{{ schemaHookResolver.resolveSetterAfterValidationHook(validationProperty) }}{% endif %}
4646

4747
return $this;
4848
}

0 commit comments

Comments
 (0)