Pass filter-provided parameters to field value factories

[PREMIUM-253]
This commit is contained in:
Jan Jakes
2024-02-02 16:31:39 +01:00
committed by Aschepikov
parent 467f1f8c8c
commit 7f63445f5a
4 changed files with 51 additions and 11 deletions

View File

@@ -137,7 +137,7 @@ class StepRunArgs {
}
/** @return mixed */
public function getFieldValue(string $key) {
public function getFieldValue(string $key, array $params = []) {
$field = $this->fields[$key] ?? null;
$subjectKey = $this->fieldToSubjectMap[$key] ?? null;
if (!$field || !$subjectKey) {
@@ -146,7 +146,7 @@ class StepRunArgs {
$entry = $this->getSingleSubjectEntry($subjectKey);
try {
$value = $field->getValue($entry->getPayload());
$value = $field->getValue($entry->getPayload(), $params);
} catch (Throwable $e) {
throw Exceptions::fieldLoadFailed($field->getKey(), $field->getArgs());
}