setValueRecursively() public static method

public static setValueRecursively ( mixed $object, string $names, mixed $value )
$object mixed
$names string
$value mixed
 private function convertRowToModel($row, $aliasToOffset, $joinsToStore)
 {
     $model = $this->extractModelFromResult($this->metaInstance, $row, $aliasToOffset[$this->alias]);
     foreach ($joinsToStore as $joinedModel) {
         if ($joinedModel->storeField()) {
             $instance = $this->extractModelFromResult($joinedModel->getModelObject(), $row, $aliasToOffset[$joinedModel->alias()]);
             Objects::setValueRecursively($model, $joinedModel->destinationField(), $instance);
         }
     }
     return $model;
 }
Beispiel #2
0
 /**
  * @test
  */
 public function shouldSetValueRecursivelyForNonExistentNestedField()
 {
     //given
     $object = new stdClass();
     //when
     Objects::setValueRecursively($object, 'field1->field2', 'value');
     //then
     $this->assertFalse(isset($object->field1));
 }