Sorry, I was wrong, I thought I was posting on BR.
Can someone explain how to check existence of record by GetReference ().
For the variable always returns true;
if:
$ entity = $ this> em-> GetReference ($ this> entity, $ id);
if ($ entity):
Will always get the same record with id does not exist;
endif;
different from:
$ repo = $ this> em-> getRepository ($ this> entity);
$ user = $ repo-> find ($ id);
if ($ user):
Only enter meet record with id;
endif;
Em segunda-feira, 18 de agosto de 2014 09h42min03s UTC-3, Marco Pivetta
escreveu:
>
> Hi João,
>
> Please keep mailing list messages in English.
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
>
> On 18 August 2014 12:19, João Carlos Santa Ana <[email protected]
> <javascript:>> wrote:
>
>> Salve guys,
>> Alguém pode explicar como verificar se existência de registro
>> pelo getReference().
>> Pois a variável sempre retorna true;
>> Se:
>> $entity = $this->em->getReference($this->entity, $id);
>> if($entity):
>> Vai sempre entrar mesmo que o registro com id não exista;
>> endif;
>>
>> diferente de:
>> $repo = $this->em->getRepository($this->entity );
>> $user = $repo->find($id);
>>
>> if($user ):
>> Só entra se encontrar registro com o id;
>> endif;
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.