public function NestedSetStorage::__call in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 src/Storage/NestedSetStorage.php \Drupal\entity_hierarchy\Storage\NestedSetStorage::__call()
File
- src/Storage/NestedSetStorage.php, line 83
Class
- NestedSetStorage
- Wraps the library nested set implementation with JIT table creation.
Namespace
Drupal\entity_hierarchy\Storage
Code
public function __call($name, $arguments) {
$try_again = FALSE;
try {
return $this
->doCall($name, $arguments);
} catch (\InvalidArgumentException $e) {
$this->logger
->emergency(sprintf('The nested set table %s is corrupt and needs to be rebuilt. Use drush entity-hierarchy-tree-rebuild command.', $this->tableName));
if ($name === 'getNode') {
return FALSE;
}
if ($name === 'findParent') {
return FALSE;
}
if (strpos($name, 'find') === 0) {
return [];
}
} catch (\Exception $e) {
if (!($try_again = $this
->ensureTableExists())) {
throw $e;
}
}
if ($try_again) {
return $this
->doCall($name, $arguments);
}
throw new \LogicException('Unexpected exception occurred.');
}