Commit 0616fed2 authored by alexpott's avatar alexpott

Issue #2269003 by damiankloip, Berdir: Fixed Unnecessary high memory usage in...

Issue #2269003 by damiankloip, Berdir: Fixed Unnecessary high memory usage in EntityType::getKeys().
parent 559115bf
......@@ -63,8 +63,11 @@ class ConfigEntityType extends EntityType {
/**
* {@inheritdoc}
*/
public function getControllerClasses() {
return parent::getControllerClasses() + array(
public function __construct($definition) {
parent::__construct($definition);
// Always add a default 'uuid' key.
$this->entity_keys['uuid'] = 'uuid';
$this->controllers += array(
'storage' => 'Drupal\Core\Config\Entity\ConfigEntityStorage',
);
}
......@@ -94,15 +97,6 @@ public function getConfigPrefix() {
return $config_prefix;
}
/**
* {@inheritdoc}
*/
public function getKeys() {
// Always add a default 'uuid' key.
return array('uuid' => 'uuid') + parent::getKeys();
}
/**
* {@inheritdoc}
*/
......
......@@ -15,8 +15,9 @@ class ContentEntityType extends EntityType implements ContentEntityTypeInterface
/**
* {@inheritdoc}
*/
public function getControllerClasses() {
return parent::getControllerClasses() + array(
public function __construct($definition) {
parent::__construct($definition);
$this->controllers += array(
'storage' => 'Drupal\Core\Entity\ContentEntityDatabaseStorage',
);
}
......
......@@ -217,6 +217,15 @@ public function __construct($definition) {
foreach ($definition as $property => $value) {
$this->{$property} = $value;
}
// Ensure defaults.
$this->entity_keys += array(
'revision' => '',
'bundle' => ''
);
$this->controllers += array(
'access' => 'Drupal\Core\Entity\EntityAccessController',
);
}
/**
......@@ -259,7 +268,7 @@ public function isFieldDataCacheable() {
* {@inheritdoc}
*/
public function getKeys() {
return $this->entity_keys + array('revision' => '', 'bundle' => '');
return $this->entity_keys;
}
/**
......@@ -318,9 +327,7 @@ public function isSubclassOf($class) {
* {@inheritdoc}
*/
public function getControllerClasses() {
return $this->controllers + array(
'access' => 'Drupal\Core\Entity\EntityAccessController',
);
return $this->controllers;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment