/** * Checks if the instance is managed by the EntityManager. * * @param object $entity * @return boolean TRUE if this EntityManager currently manages the given entity * (and has it in the identity map), FALSE otherwise. */ public function contains($entity) { return $this->_unitOfWork->isInIdentityMap($entity) && !$this->_unitOfWork->isRegisteredRemoved($entity); }