You are here

public function ConfigSplitManager::getSplitEntity in Configuration Split 2.0.x

Get a split entity.

Parameters

string $name: The split name.

Return value

\Drupal\config_split\Entity\ConfigSplitEntity|null The config entity.

File

src/ConfigSplitManager.php, line 150

Class

ConfigSplitManager
The manager to split and merge.

Namespace

Drupal\config_split

Code

public function getSplitEntity(string $name) : ?ConfigSplitEntity {
  $config = $this
    ->getSplitConfig($name);
  if ($config === NULL) {
    return NULL;
  }
  $entity = $this->manager
    ->loadConfigEntityByName($config
    ->getName());
  if ($entity instanceof ConfigSplitEntity) {
    return $entity;
  }

  // Do we throw an exception? Do we return null?
  // @todo find out in what legitimate case this could possibly happen.
  throw new \RuntimeException('A split config does not load a split entity? something is very wrong.');
}