I am finding a entity by its PK as follow:
$ent = $em->getRepository('AppBundle:Representative')->find($id)
What is the right way to check whether $ent is a real Representative object or not? What I mean with real is that $ent currently exists on DB and was returned since I am planning to use the same results for INSERT and UPDATE. In pseudo-code what is on my head is:
if (ent is Representative)
{
    // Update its values
} else {
    // Create a new Representative
}
I was thinking in use is_object() or even instanceof but I am not sure if they will do the job or if $ent will be an object even if Representative doesn't exist on DB. Any advice on this? How I can achieve that?
 
     
    