/** * Loop through all gettable properties of the $newObject and call update() * on them if they are entities/valueobjects. * This makes sure that changes to subobjects of a given object are * persisted as well. * * @param object $newObject The new object to loop over * @author Sebastian Kurfürst <*****@*****.**> */ protected function updateRecursively($newObject) { $propertiesOfNewObject = \F3\FLOW3\Reflection\ObjectAccess::getGettableProperties($newObject); foreach ($propertiesOfNewObject as $subObject) { if ($subObject instanceof \F3\FLOW3\Persistence\Aspect\DirtyMonitoringInterface && $subObject->FLOW3_Persistence_isClone()) { $this->updateObject($subObject); $this->updateRecursively($subObject); } } }
/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function getGettablePropertiesReturnsTheCorrectValuesForAllProperties() { $allProperties = \F3\FLOW3\Reflection\ObjectAccess::getGettableProperties($this->dummyObject); $expectedProperties = array('anotherProperty' => 42, 'property' => 'string1', 'property2' => NULL, 'publicProperty' => NULL, 'publicProperty2' => 42); $this->assertEquals($allProperties, $expectedProperties, 'expectedProperties did not return the right values for the properties.'); }