Issue #2269003 by damiankloip, Berdir: Fixed Unnecessary high memory usage in EntityType::getKeys().

8.0.x
Alex Pott 2014-06-20 16:13:17 +01:00
parent 559115bf0d
commit 0616fed294
3 changed files with 19 additions and 17 deletions

View File

@ -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 @@ class ConfigEntityType extends EntityType {
return $config_prefix;
}
/**
* {@inheritdoc}
*/
public function getKeys() {
// Always add a default 'uuid' key.
return array('uuid' => 'uuid') + parent::getKeys();
}
/**
* {@inheritdoc}
*/

View File

@ -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',
);
}

View File

@ -217,6 +217,15 @@ class EntityType implements EntityTypeInterface {
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 @@ class EntityType implements EntityTypeInterface {
* {@inheritdoc}
*/
public function getKeys() {
return $this->entity_keys + array('revision' => '', 'bundle' => '');
return $this->entity_keys;
}
/**
@ -318,9 +327,7 @@ class EntityType implements EntityTypeInterface {
* {@inheritdoc}
*/
public function getControllerClasses() {
return $this->controllers + array(
'access' => 'Drupal\Core\Entity\EntityAccessController',
);
return $this->controllers;
}
/**