[FLOW3-general] How can i catch TYPO3\FLOW3\Persistence\Exception\ObjectValidationFailedException in controllerAction
mosaiq_marcel
mosaiq_marcel at web.de
Fri May 4 09:10:48 CEST 2012
Hi Pankaj,
thanks a lot, that's the solution.
When I think about this problem, then it sounds logical because the
exception is thrown by Doctrine when it's persist all changes at the end
of my script - and that's outside of my controller action, right?
Am 03.05.2012 21:58, schrieb Pankaj Lele:
> Hi Marcel,
>
>> How can i catch this exception to give back a user friendly error message?
>
> You have to explicitly call the persistenceManager->persistAll() after
> the repository operation to catch exception. ->persistAll() is by
> default called after the action is executed somewhere in the core.
>
> So you can just inject the persistenceManager in your controller
>
> /**
> * @var \TYPO3\FLOW3\Persistence\PersistenceManagerInterface
> * @FLOW3\Inject
> */
> protected $persistenceManager;
>
> and then right after the $this->partyRepository->add($person); you can
> add a line $this->persistenceManager->persistAll(); and you will be able
> to catch the exception.
>
>
More information about the FLOW3-general
mailing list