[FLOW3-general] Validate if an object is unique

David Sporer david.sporer at gmail.com
Thu Feb 28 11:24:32 CET 2013


He wrote that he did but I think the UniqueEntityValidator only works if
you annotate your property with the Identity Annotation.


2013/2/28 Mattias Nilsson <tollepjaer at gmail.com>

> Hi,
>
> In the current master of TYPO3 Flow is there an *UniqueEntityValidator,
> *take
> a look into that.
>
> *
>
> http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git/blob/master:/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php
> *
>
> /Mattias
>
>
> On Thu, Feb 28, 2013 at 10:58 AM, Manfred Rutschmann - VOLUMEN
> Werbe-/Internetagentur <rutschmann at agentur-volumen.de> wrote:
>
> > Hi Cornel,
> >
> > i have the same problem. For this way you can`t catch the given
> Excpetion.
> > For this case i have to use a little check in the controller:
> >
> > $checkIdentity =
> > $this->countryRepository->findByName($country->getName())->count();
> >
> > Dirty but effective ;-)
> >
> > Regards Manfred
> >
> >
> >
> >
> > Am 27.02.2013 um 19:09 schrieb Widmer Cornel <cornel at kollerinternet.ch>:
> >
> > > In my application it is possible to create new users. The e-mail adress
> > is used as identifier for the username (account). When I create a new
> user
> > over the form with an existing e-mail flow throws the error: "Integrity
> > constraint violation: 1062 Duplicate entry".
> > >
> > > How can I validate this?
> > >
> > > I tried to validate on the controller-action with "UniqueEntity" but
> > then i got the error: "The object supplied for the UniqueEntityValidator
> > must have at least one identity property."
> > >
> > > Is there a way on the model to achive this?
> > > _______________________________________________
> > > 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
> >
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>



-- 
If you're interested in my work you can follow me or my current project
@sporerd <https://twitter.com/sporerd> and
@PasscreatorDe<https://twitter.com/PasscreatorDe>


More information about the FLOW3-general mailing list