[Flow] Custom Property Mapper and Validation
Mathis Hoffmann
mathis at hoffpost.de
Wed Jul 24 23:53:42 CEST 2013
Hello again,
I just found out that this is much easier to archive using the type
hinting mechanism (adding a __type-attribute to the property by using a
(hidden) form field <... property='__type'
value='MyFullyQualifiedClassName' ..> ). That works so far fine for the
creation of new objects. But I don't know how to add that type hint when
fetching objects from persistence via a get request. Normally I would
add a link like <f:link.action [...] arguments={argumentname: object} />
which results in a link containing the __identity. But the
__type-attribute is missing and I really do not know how to include
that. Any ideas? I would like to avoid using the concrete classnames in
my controller..
Cheers
Mathis
Am 24.07.2013 18:41, schrieb Mathis Hoffmann:
> 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
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list