title: How to determine if a Doctrine entity is persisted?
body: <p>Is there a way to determine if a parameter is an object that is already persisted by Doctrine or not? Something like an entity manager method that checks that an object is not a plain old object but actually something already in memory/persisted.</p>
  
  <pre><code>&lt;?php
  public function updateStatus(Entity $entity, EntityStatus $entityStatus)
  {
      $entityManager = $this-&gt;getEntityManager();
      try {
          // checking persisted entity
          if (!$entityManager-&gt;isPersisted($entity)) { 
              throw new InvalidArgumentException('Entity is not persisted');
          }
          // ...
      } catch (InvalidArgumentException $e) {
      }
  }
  </code></pre>