/** * Are the both entity records equal in means of database record * @param Entity $entity * @return boolean */ public function equals(Entity $entity = null) { if ($entity === null) { return false; } // Equals if matches if ($entity === $this) { return true; } $id = $this->getId(); if (!empty($id) && $entity->getId() === $id) { return true; } return false; }