protected function getClassMetadata(string $class): ClassMetadata
    {
        $factory = $this->getDoctrineHelper()->getMetadataFactory();
        if (!$factory->hasMetadataFor($class)) {
            throw new \InvalidArgumentException(sprintf('No metadata found for class "%s"', $class));
        }
        
        return $factory->getMetadataFor($class);
    }