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 { ...@@ -63,8 +63,11 @@ class ConfigEntityType extends EntityType {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getControllerClasses() { public function __construct($definition) {
return parent::getControllerClasses() + array( parent::__construct($definition);
// Always add a default 'uuid' key.
$this->entity_keys['uuid'] = 'uuid';
$this->controllers += array(
'storage' => 'Drupal\Core\Config\Entity\ConfigEntityStorage', 'storage' => 'Drupal\Core\Config\Entity\ConfigEntityStorage',
); );
} }
...@@ -94,15 +97,6 @@ public function getConfigPrefix() { ...@@ -94,15 +97,6 @@ public function getConfigPrefix() {
return $config_prefix; return $config_prefix;
} }
/**
* {@inheritdoc}
*/
public function getKeys() {
// Always add a default 'uuid' key.
return array('uuid' => 'uuid') + parent::getKeys();
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -15,8 +15,9 @@ class ContentEntityType extends EntityType implements ContentEntityTypeInterface ...@@ -15,8 +15,9 @@ class ContentEntityType extends EntityType implements ContentEntityTypeInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getControllerClasses() { public function __construct($definition) {
return parent::getControllerClasses() + array( parent::__construct($definition);
$this->controllers += array(
'storage' => 'Drupal\Core\Entity\ContentEntityDatabaseStorage', 'storage' => 'Drupal\Core\Entity\ContentEntityDatabaseStorage',
); );
} }
......
...@@ -217,6 +217,15 @@ public function __construct($definition) { ...@@ -217,6 +217,15 @@ public function __construct($definition) {
foreach ($definition as $property => $value) { foreach ($definition as $property => $value) {
$this->{$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() { ...@@ -259,7 +268,7 @@ public function isFieldDataCacheable() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getKeys() { public function getKeys() {
return $this->entity_keys + array('revision' => '', 'bundle' => ''); return $this->entity_keys;
} }
/** /**
...@@ -318,9 +327,7 @@ public function isSubclassOf($class) { ...@@ -318,9 +327,7 @@ public function isSubclassOf($class) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getControllerClasses() { public function getControllerClasses() {
return $this->controllers + array( return $this->controllers;
'access' => 'Drupal\Core\Entity\EntityAccessController',
);
} }
/** /**
......
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