Skip to content

Commit

Permalink
process Closure expr the same way
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 17, 2023
1 parent 7bb89f4 commit 05a4b64
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Form/Control/Multiline.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,7 @@ private function getExpressionValues(Model $entity): array
{
$dummyFields = $this->getExpressionFields($entity);
foreach ($dummyFields as $k => $field) {
if (!$field->expr instanceof \Closure) {
$dummyFields[$k]->expr = $this->getDummyExpression($field, $entity);
}
$dummyFields[$k]->expr = $this->getDummyExpression($field, $entity);
}

if ($dummyFields === []) {
Expand Down Expand Up @@ -830,6 +828,9 @@ private function getExpressionValues(Model $entity): array
private function getDummyExpression(SqlExpressionField $exprField, Model $entity)
{
$expr = $exprField->expr;
if ($expr instanceof \Closure) {
$expr = $exprField->getDsqlExpression($entity->getModel()->expr(''));
}
if ($expr instanceof Persistence\Sql\Expression) {
$expr = \Closure::bind(fn () => $expr->template, null, Persistence\Sql\Expression::class)();
}
Expand Down

0 comments on commit 05a4b64

Please sign in to comment.