« Previous | Next » 

Revision c834eaed

Parent 43503921
Child 56975261

Added by Bastian Waidelich almost 7 years ago

[FEATURE] Allow custom handling of propertyMapping errors

Previously if an entity wasn't found during property mapping an
exception was thrown before the action was invoked making it
difficult to change the default behavior of showing a 404 error.

This change adjusts the ``PersistentObjectConverter`` to return
a ``TargetNotFoundError`` in that case instead of throwing an
exception. It also extends the ``\TYPO3\Flow\Error\Result``
class by a method ``getFlattenedErrorsOfType()`` that allows to
retrieve all errors implementing a given class or interface.

The default ``errorAction`` of the ``ActionController`` now
checks the validation result for TargetNotFoundErrors and throws
an exception if that's the case. But this behavior can now be
changed by overriding ``handleTargetNotFoundError()``::

protected function handleTargetNotFoundError() {
try {
} catch (TargetNotFoundException $exception) {
// custom behavior (e.g. redirect to some action)

Change-Id: I5231ccddaef1a6b49e62bb29bdd3ff99dc2bb994
Resolves: FLOW-197
Release: master

  • added
  • modified
  • copied
  • renamed
  • deleted