From cc61eca0837a59246c0538f90f5b01a3c11264fb Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Thu, 25 Jul 2024 17:47:48 +0200 Subject: [PATCH] do not instanciate an own EelEvaluator but use the DI for that --- Classes/EelFilenameTrait.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/EelFilenameTrait.php b/Classes/EelFilenameTrait.php index be0ae00..eb1fcbf 100644 --- a/Classes/EelFilenameTrait.php +++ b/Classes/EelFilenameTrait.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace DigiComp\AttachmentViewUtility; -use Neos\Eel\CompilingEvaluator; use Neos\Eel\Context; +use Neos\Eel\EelEvaluatorInterface; use Neos\Eel\Helper\ArrayHelper; use Neos\Eel\Helper\StringHelper; use Neos\Flow\Annotations as Flow; @@ -17,6 +17,9 @@ trait EelFilenameTrait { protected string $eelExpressionOptionKey = 'filenameEelExpression'; + #[Flow\Inject(name: EelEvaluatorInterface::class, lazy: false)] + protected EelEvaluatorInterface $eelEvaluator; + protected function addOptionFilenameEelExpression(): void { if (\property_exists($this, 'supportedOptions')) { @@ -59,7 +62,7 @@ trait EelFilenameTrait 'Translation' => new TranslationHelper(), ])); $this->emitFilenameEelExpressionContext($context); - return (new CompilingEvaluator())->evaluate($expression, $context); + return $this->eelEvaluator->evaluate($expression, $context); } /**