[Flow] Custom Property Mapper and Validation
Mathis Hoffmann
mathis at hoffpost.de
Wed Jul 24 18:41:07 CEST 2013
Hello,
I've written my own type converter that allows property mapping of
inherited types. For example I have a CustomerInterface, a Customer
which is abstract and implements the interface and to concrete classes
BusinessCustomer and PrivateCustomer that inherit from Customer. I have
written an abstract type converter (http://pastebin.com/jmHtdrEj) that
provides the functionality and inherits from PersistentObjectConverter.
It basically determines the concrete type based on a 'type'-parameter
from the webform, adjusts the $targetType-variable and hands the request
over to the convertFrom-method of PersistentObjectConverter. For every
interface-type I create a seperate converter that inherit from my
abstract converter and do some configuration (for example configure
which conrete types exists and so on). For the customer-example it looks
like the following: http://pastebin.com/dK1cvavQ .
That works quite fine - exept that fact that the validation does not
work. Using my custom converter Flow only validates before persisting
the object and not before passing the mapped object to the controller.
Therefore I cannot display any validation errors in the form - instead I
get an uncaught exception.
Does anyone know how to turn on validation in the property mapper? I
thought it should work because I only change the target type in my
custom converter and hand the work on to the Flow-internal converter.
Cheers
Mathis
More information about the Flow
mailing list