EntityRepository::getClassMetadata is protected, thus use EntityManager::getClassMetadata instread