Calling Doctrine clear() with an argument is deprecated

  doctrine, entitymanager, symfony

Doctrine advises that –

Calling DoctrineORMEntityManager::clear() with any arguments to
clear specific entities is deprecated since doctrine/persistence 1.3 and will be removed in 2.0.

We have a lot of references to ->clear(SpecificEntity::class) in our Symfony codebase and are looking to update these, but we’re struggling to find a suggested replacement in the latest upgrade guide.

Is there a recommended alternative to clear a specific entity in the latest version of Doctrine?

Source: Symfony Questions