[FLOW3-general] Validation of ElectronicAddress items
"Christian Müller (Kitsunet)"
christian.mueller at typo3.org
Fri Jul 20 23:16:35 CEST 2012
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
More information about the FLOW3-general
mailing list