From 430926462e04bb5edffb0a91dca97fb6a0494585 Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Thu, 24 Apr 2025 13:58:02 +0200 Subject: [PATCH] Expose formula expression in api resource --- src/ApiResource/Matchfunding/FormulaApiResource.php | 6 ++++++ src/State/Matchfunding/FormulaStateProvider.php | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ApiResource/Matchfunding/FormulaApiResource.php b/src/ApiResource/Matchfunding/FormulaApiResource.php index 1fd0ae6..345136d 100644 --- a/src/ApiResource/Matchfunding/FormulaApiResource.php +++ b/src/ApiResource/Matchfunding/FormulaApiResource.php @@ -19,4 +19,10 @@ class FormulaApiResource { #[API\ApiProperty(identifier: true, writable: false)] public string $name; + + /** + * The underlying math expressed as a common-notation formula. + */ + #[API\ApiProperty(writable: false)] + public string $expression; } diff --git a/src/State/Matchfunding/FormulaStateProvider.php b/src/State/Matchfunding/FormulaStateProvider.php index 566e81d..1f21c9c 100644 --- a/src/State/Matchfunding/FormulaStateProvider.php +++ b/src/State/Matchfunding/FormulaStateProvider.php @@ -41,6 +41,7 @@ class FormulaStateProvider implements ProviderInterface { $resource = new FormulaApiResource(); $resource->name = $formula::getName(); + $resource->expression = $formula::getAsExpression(); return $resource; }