You can't: `getReference()` is meant to create a Proxy (or Entity if it's already loaded) _without_ contacting the database.
If you need to rely on the existence in the database, you'll have to use `find()`. -- Jasper N. Brouwer (@jaspernbrouwer) On 19 August 2014 at 14:56:58, João Carlos Santa Ana ([email protected]) wrote: > 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; -- 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.
