[FLOW3-general] Validation of ElectronicAddress items
Steffen Wickham
steffen at gaming-inc.de
Sat Jul 21 00:21:43 CEST 2012
Okay, I've played a little bit with the "type" value directly in database.
The correct syntax for non framework validators would be:
"Vendor\Package:Validator", i.e. "AFSVN\Base:Skype" for my problem. But
due to the validation annotation in ElectronicAddress, the type value
have to be alphanumeric so backslash and colon are not allowed here. But
there is an other issue coming up: An error occurred while trying to
call AFSVN\Base\Controller\RefereeController->showAction(). Error for
referee.person.electronicAddresses.1: Object expected, string given.
This error message will be "thrown" by
GenericObjectValidator->validate(). Couldn't figure out why but will
keep an eye on it.
Greetings
Steffen
Am 20.07.2012 23:53, schrieb Steffen Wickham:
> Hi Christian,
>
> thanks for your reply! I just spend some more hours on inverstigation
> this issue but your reply still confirm what I figured out.
> As you suggested, I put my validator to the framework package and it
> simply works. But that's not the way I meant to code my packages. ;)
>
> Because of my hard day I will open a ticket for this issue tomorrow.
> Maybe I will try to find a proper solution for this by my own and share
> it with all of you - just try to find a solution together. I will keep
> the ticket open and up to date.
>
> Thanks for your help!
>
> Best wishes
> Steffen
>
> Am 20.07.2012 23:16, schrieb "Christian Müller (Kitsunet)":
>> On 20.07.2012 16:34, Steffen Wickham wrote:
>>> Hello,
>> Hi Steffen,
>>
>>> When I add a new \TYPO3\Party\Domain\Model\ElectronicAddress object with
>>> type="Email" and a proper email address for the identifier variable
>>> everything works fine.
>>> But when I add another object with any other type except "Email", I
>>> still get an error message (no exception!) as follows:
>>>
>>> An error occurred while trying to call
>>> AFSVN\Base\Controller\RefereeController->showAction(). Error for
>>> referee.person.electronicAddresses.1: No validator found for electronic
>>> address of type "Skype".
>>>
>> You are totally right, I just took a quick look and it seems to be a
>> bug in the current implementation. You basically have no chance to use
>> it like that. You could extend the EletronicAddress and then implement
>> your own validator for that, but as it is currently we should ship
>> validators for all the types.
>>
>>> So I created a new validator for my Skype addresses and called the class
>>> "SkypeAddressValidator" and derived it from
>>> \TYPO3\FLOW3\Validation\Validator\AbstractValidator like the provided
>>> validator for email addresses of the FLOW3 framework. But i couldn't
>>> figure out, how to tell the framework to use this validator for this
>>> validation. I tried to put it in Validation, Validation/Validator and
>>> Validator subfolders of my package (and changed the namespace
>>> accordingly) but nothing changed.
>> Yes indeed, looking at the ElectronicAddress validator it tries to
>> find a validator with the same name as the type + 'Address', which
>> results in EmailAddress or SkypeAddress, but without a namespace it
>> will look for it in TYPO3\FLOW3\ so your *could* for now put a
>> SkypeAddress validator in \TYPO3\FLOW3\Validation\Validators (where
>> EmailAddressValidator is too), but of course that is not really
>> desireable. I am also not aware of a way to override the default
>> EletronicAddress Validator or define another place for the
>> SkypeAddress Validator. There could be a way to use a custom type with
>> a namespace, but I would need to lookup the correct syntax for that,
>> should be something in the way of 'Vendor:Package:Skype'.
>>
>> It would be awesome if you could open a ticket for the missing
>> validators / problem on forge.typo3.org in FLOW3 Base Distribution.
>> Thanks in advance!
>>
>> Cheers,
>> Christian
>>
>> _______________________________________________
>> FLOW3-general mailing list
>> FLOW3-general at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list