Skip to content
Snippets Groups Projects
Commit 4d244cd2 authored by Florian Weber's avatar Florian Weber Committed by Ken Rickard
Browse files

Issue #3405191 by webflo, agentrickard: Avoid loading all domains in DomainStorage::create

parent 9a2032f2
No related branches found
No related tags found
1 merge request!60Avoid loading all domains
Pipeline #212968 passed
......@@ -153,7 +153,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
*/
public function create(array $values = []) {
$default = $this->loadDefaultId();
$domains = $this->loadMultiple();
$count = $this->getQuery()->accessCheck(FALSE)->count()->execute();
if (empty($values)) {
$values['hostname'] = $this->createHostname();
$values['name'] = \Drupal::config('system.site')->get('name');
......@@ -161,7 +161,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
$values += [
'scheme' => $this->getDefaultScheme(),
'status' => '1',
'weight' => count($domains) + 1,
'weight' => $count + 1,
'is_default' => (int) empty($default),
];
$domain = parent::create($values);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment