/**
  * @param string $entityClass
  * @param string $version
  *
  * @return array|null
  */
 protected function loadConfig($entityClass, $version)
 {
     $config = $this->configBag->getRelationConfig($entityClass, $version);
     if (empty($config) || ConfigUtil::isInherit($config)) {
         $parentClasses = $this->entityHierarchyProvider->getHierarchyForClassName($entityClass);
         foreach ($parentClasses as $parentClass) {
             $parentConfig = $this->configBag->getRelationConfig($parentClass, $version);
             if (!empty($parentConfig)) {
                 $config = $this->mergeConfigs($parentConfig, $config);
                 if (!ConfigUtil::isInherit($parentConfig)) {
                     break;
                 }
             }
         }
     }
     return !empty($config) ? $config : null;
 }