Can you properly type this code in the ORMAdapter by adding the EntityManagerInterface type to the $manager attribute and to the afterConfiguration method in order to replace the test "$manager instanceof EntityManager"?
Indeed, if we try to override the manager with a decorated manager, the test $manager instanceof EntityManager fails and throws an exception.
But it works correctly by adding an instanceof EntityManagerInterface and it's more SOLID to test an Interface.
/**
* @param ORMOptions $options
*/
protected function afterConfiguration(array $options): void
{
// Enable automated mode or just get the general default entity manager
$manager = $this->registry->getManagerForClass($options['entity']);
if (!$manager instanceof EntityManagerInterface) {
throw new InvalidConfigurationException(sprintf('Doctrine has no valid entity manager for entity "%s", is it correctly imported and referenced?', $options['entity']));
}
....
}
Hello,
Can you properly type this code in the ORMAdapter by adding the EntityManagerInterface type to the $manager attribute and to the afterConfiguration method in order to replace the test "$manager instanceof EntityManager"?
Indeed, if we try to override the manager with a decorated manager, the test $manager instanceof EntityManager fails and throws an exception.
But it works correctly by adding an instanceof EntityManagerInterface and it's more SOLID to test an Interface.