Skip to content

Commit 1d2ef53

Browse files
committed
BUGFIX: Set property to null via objects yaml
1 parent 62ce667 commit 1d2ef53

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

Neos.Flow/Classes/ObjectManagement/DependencyInjection/ProxyClassBuilder.php

+2
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ protected function buildPropertyInjectionCode(Configuration $objectConfiguration
368368
$preparedSetterArgument = var_export($propertyValue, true);
369369
} elseif (is_bool($propertyValue)) {
370370
$preparedSetterArgument = $propertyValue ? 'true' : 'false';
371+
} elseif ($propertyValue === null) {
372+
$preparedSetterArgument = 'null';
371373
} else {
372374
$preparedSetterArgument = $propertyValue;
373375
}

Neos.Flow/Configuration/Testing/Objects.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Neos\Flow\Tests\Functional\ObjectManagement\Fixtures\SingletonClassC:
3737
value: true
3838
protectedBooleanFalsePropertySetViaObjectsYaml:
3939
value: false
40+
protectedNullPropertySetViaObjectsYaml:
41+
value: null
4042
protectedArrayPropertyWithSetterSetViaObjectsYaml:
4143
value: {'and': 'something from Objects.yaml'}
4244
arguments:

Neos.Flow/Tests/Functional/ObjectManagement/DependencyInjectionTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function propertiesOfVariousPrimitiveTypeAreSetInSingletonPropertiesIfCon
7171
self::assertSame(['iAm' => ['aConfigured' => 'arrayValue']], $objectC->getProtectedArrayPropertySetViaObjectsYaml());
7272
self::assertTrue($objectC->getProtectedBooleanTruePropertySetViaObjectsYaml());
7373
self::assertFalse($objectC->getProtectedBooleanFalsePropertySetViaObjectsYaml());
74+
self::assertNull($objectC->getProtectedNullPropertySetViaObjectsYaml());
7475
}
7576

7677
/**

Neos.Flow/Tests/Functional/ObjectManagement/Fixtures/SingletonClassC.php

+10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class SingletonClassC
6060
*/
6161
protected $protectedBooleanFalsePropertySetViaObjectsYaml;
6262

63+
/**
64+
* @var null
65+
*/
66+
protected $protectedNullPropertySetViaObjectsYaml;
67+
6368
/**
6469
* @var array
6570
*/
@@ -123,6 +128,11 @@ public function getProtectedBooleanFalsePropertySetViaObjectsYaml()
123128
return $this->protectedBooleanFalsePropertySetViaObjectsYaml;
124129
}
125130

131+
public function getProtectedNullPropertySetViaObjectsYaml()
132+
{
133+
return $this->protectedNullPropertySetViaObjectsYaml;
134+
}
135+
126136
/**
127137
* @return array
128138
*/

0 commit comments

Comments
 (0)