I can do:
$key = 'address';
$user->{$key}
Is there some way to make this work for deeper levels? I do not know in advance how many levels.
$key = 'address->street';
$user->{$key}
Here is what I am actually trying to achieve:
$filterIds = [];
$filterIds['facebook->followers'] = 1;
$filterIds['googleplus->followers'] = 2;
$filterIds['instagram->followers'] = 3;
...
foreach($filterIds as $filterKey => $filterId) {
if(self::property_path_exists($data, $filterKey)) {
$filter = new ResultFilter;
$filter->result_filter_id = $filterId;
$filter->value = $data->{$filterKey};
$filter->save();
}
}