[FLOW3-general] How can i catch TYPO3\FLOW3\Persistence\Exception\ObjectValidationFailedException in controllerAction

Pankaj Lele pankaj at lelesys.com
Thu May 3 21:58:08 CEST 2012


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.


-- 

With best regards,
Pankaj Lele
---------------------------

CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India

Web: http://www.lelesys.com

[Certified TYPO3 Integrator]


More information about the FLOW3-general mailing list