function ExecutionState::fetchDataByPropertyPath

Overrides ExecutionStateInterface::fetchDataByPropertyPath

1 call to ExecutionState::fetchDataByPropertyPath()
ExecutionState::autoSave in src/Context/ExecutionState.php
Saves all variables that have been marked for auto saving.

File

src/Context/ExecutionState.php, line 150

Class

ExecutionState
The rules execution state.

Namespace

Drupal\rules\Context

Code

public function fetchDataByPropertyPath($property_path, $langcode = NULL) {
    try {
        // Support global context names as variable name by ignoring points in
        // the service name; e.g. @user.current_user_context:current_user.name.
        if ($property_path[0] == '@') {
            [
                $service,
                $property_path,
            ] = explode(':', $property_path, 2);
        }
        $parts = explode('.', $property_path);
        $var_name = array_shift($parts);
        if (isset($service)) {
            $var_name = $service . ':' . $var_name;
        }
        return $this->getDataFetcher()
            ->fetchDataBySubPaths($this->getVariable($var_name), $parts, $langcode);
    } catch (InvalidArgumentException $e) {
        // Pass on the original exception in the exception trace.
        throw new EvaluationException($e->getMessage(), 0, $e);
    } catch (MissingDataException $e) {
        // Pass on the original exception in the exception trace.
        throw new EvaluationException($e->getMessage(), 0, $e);
    }
}