Skip to content

Commit

Permalink
fix: Replace ResourceBased formvalues in fusion forms too
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-K committed Jul 22, 2024
1 parent 7a78017 commit ed7d162
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Classes/FusionForm/Runtime/Action/DatabaseStorageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use Neos\Flow\Mvc\ActionResponse;
use Neos\Fusion\Form\Runtime\Action\AbstractAction;
use Neos\Fusion\Form\Runtime\Domain\Exception\ActionException;
use Neos\Media\Domain\Model\ResourceBasedInterface;

use Wegmeister\DatabaseStorage\Domain\Model\DatabaseStorage;
use Wegmeister\DatabaseStorage\Domain\Repository\DatabaseStorageRepository;

Expand All @@ -39,12 +41,20 @@ public function perform(): ?ActionResponse
$identifier = '__undefined__';
}

foreach ($formValues as $formElementIdentifier => $formValue) {
if ($formValue instanceof ResourceBasedInterface) {
$formValues[$formElementIdentifier] = $formValue->getResource();
}
}

$dbStorage = new DatabaseStorage();
$dbStorage->setStorageidentifier($identifier)->setProperties($formValues)->setDateTime(new \DateTime());
$dbStorage
->setStorageidentifier($identifier)
->setProperties($formValues)
->setDateTime(new \DateTime());

$this->databaseStorageRepository->add($dbStorage);

return null;
}

}

0 comments on commit ed7d162

Please sign in to comment.