$entityManager = Doctrine\ORM\EntityManager::create($conn, $config); $book = $entityManager->getRepository(Book::class)->find(1); $book->setName("New Name"); $entityManager->refresh($book);In this example, an entity manager and a book entity are created. The name of the book entity is then changed to "New Name". The refresh() method is called to retrieve the current version of the entity from the database, overwriting any changes made to the object. In the end, the name of the book entity will be reverted to its original value. Package Library: This code example uses the Doctrine ORM package library.