function ViewExecutable::destroy
Same name in other branches
- 9 core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::destroy()
- 8.9.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::destroy()
- 11.x core/modules/views/src/ViewExecutable.php \Drupal\views\ViewExecutable::destroy()
Unsets references so that a $view object may be properly garbage collected.
File
-
core/
modules/ views/ src/ ViewExecutable.php, line 2110
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\viewsCode
public function destroy() {
foreach ($this::getHandlerTypes() as $type => $info) {
if (isset($this->{$type})) {
foreach ($this->{$type} as $handler) {
$handler->destroy();
}
}
}
if (isset($this->style_plugin)) {
$this->style_plugin
->destroy();
}
$reflection = new \ReflectionClass($this);
$defaults = $reflection->getDefaultProperties();
// The external dependencies should not be reset. This is not generated by
// the execution of a view.
unset($defaults['storage'], $defaults['user'], $defaults['request'], $defaults['routeProvider'], $defaults['displayPluginManager'], $defaults['viewsData']);
foreach ($defaults as $property => $default) {
$this->{$property} = $default;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.