[Flow] Custom Property Mapper and Validation
Mathis Hoffmann
mathis at hoffpost.de
Thu Jul 25 09:57:36 CEST 2013
Hello,
yes, Christian, you're right. The get request works now. But I had to
delete the Interface because using the interface-type as controller
argument type does not work. I now use the abstract class as controller
argument and that works. But for an update request (of a persisted
entity with given __identity) it does not work for me. There I need the
__type parameter. Is that right or am I'm doing something wrong. If I
leave that out in my edit-form Flow tries to map to the abstract type
which leads to an error.
Another problem I have come across is that validation before passing the
object to the controller does only work for arguments that are not in
the abstract type. In my example I have the abstract Customer and a
concrete BusinessCustomer which has an additional attribute businessName
(which Customer does not have). I added a NotEmpty-validator to that
attribute. Now, if I leave that form-field empty, Flow does not redirect
me to the form again but instead throws an error: #1297759968: Exception
while property mapping for target type
"HdM\Accounting\Domain\Customer\Model\Customer", at property path "":
Property "businessName" was not found in target object of type
"HdM\Accounting\Domain\Customer\Model\Customer".
For other attributes that the abstract class already contains (like
firstName and others) Flow does not throw this error but instead
redirects me to the form again and correctly displays the validation
results.
Maybe this is a bug?
Cheers
Mathis
Am 25.07.2013 08:39, schrieb Christian Müller:
> Hi,
>
> Mathis Hoffmann wrote:
>> 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..
>
> On editing with the UUID it will fetch the correct object (with
> correct type) anyway as UUIDs are and should be unique across all
> tables (probably even across the world ;)) so that shouldn't matter on
> editing.
>
>>
>> Cheers
>> Mathis
>>
>
> Cheers,
> Christian
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list