Commit 20315e1d authored by alexpott's avatar alexpott

Issue #2164827 by Berdir, Xano, tim.plunkett: Rename the entityInfo() and...

Issue #2164827 by Berdir, Xano, tim.plunkett: Rename the entityInfo() and entityType() methods on EntityInterface and EntityStorageControllerInterface.
parent aa03c3dd
......@@ -501,7 +501,7 @@ function entity_list_controller($entity_type) {
* A render array for the entity.
*/
function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) {
$render_controller = \Drupal::entityManager()->getViewBuilder($entity->entityType());
$render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId());
if ($reset) {
$render_controller->resetCache(array($entity->id()));
}
......@@ -511,7 +511,7 @@ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $res
/**
* Returns the render array for the provided entities.
*
* @param array $entities
* @param \Drupal\Core\Entity\EntityInterface[] $entities
* The entities to be rendered, must be of the same type.
* @param string $view_mode
* The view mode that should be used to display the entity.
......@@ -527,7 +527,7 @@ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $res
* entities array passed in $entities.
*/
function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $reset = FALSE) {
$render_controller = \Drupal::entityManager()->getViewBuilder(reset($entities)->entityType());
$render_controller = \Drupal::entityManager()->getViewBuilder(reset($entities)->getEntityTypeId());
if ($reset) {
$render_controller->resetCache(array_keys($entities));
}
......@@ -619,7 +619,7 @@ function entity_get_display($entity_type, $bundle, $view_mode) {
* @see entity_get_display().
*/
function entity_get_render_display(EntityInterface $entity, $view_mode) {
$entity_type = $entity->entityType();
$entity_type = $entity->getEntityTypeId();
$bundle = $entity->bundle();
$render_view_mode = 'default';
......@@ -727,7 +727,7 @@ function entity_get_form_display($entity_type, $bundle, $form_mode) {
* @see entity_get_form_display().
*/
function entity_get_render_form_display(EntityInterface $entity, $form_mode) {
$entity_type = $entity->entityType();
$entity_type = $entity->getEntityTypeId();
$bundle = $entity->bundle();
$render_form_mode = 'default';
......
......@@ -23,7 +23,7 @@ public function load() {
// Sort the entities using the entity class's sort() method.
// See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
uasort($entities, array($this->entityInfo->getClass(), 'sort'));
uasort($entities, array($this->entityType->getClass(), 'sort'));
return $entities;
}
......@@ -41,7 +41,7 @@ public function getOperations(EntityInterface $entity) {
$operations['edit']['href'] = $uri['path'];
}
if ($this->entityInfo->hasKey('status')) {
if ($this->entityType->hasKey('status')) {
if (!$entity->status()) {
$operations['enable'] = array(
'title' => t('Enable'),
......
......@@ -96,8 +96,8 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con
public function __construct(EntityTypeInterface $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service) {
parent::__construct($entity_info);
$this->idKey = $this->entityInfo->getKey('id');
$this->statusKey = $this->entityInfo->getKey('status');
$this->idKey = $this->entityType->getKey('id');
$this->statusKey = $this->entityType->getKey('status');
$this->configFactory = $config_factory;
$this->configStorage = $config_storage;
......@@ -183,14 +183,14 @@ public function deleteRevision($revision_id) {
* {@inheritdoc}
*/
public function getQuery($conjunction = 'AND') {
return $this->entityQueryFactory->get($this->entityType, $conjunction);
return $this->entityQueryFactory->get($this->entityTypeId, $conjunction);
}
/**
* {@inheritdoc}
*/
public function getConfigPrefix() {
return $this->entityInfo->getConfigPrefix() . '.';
return $this->entityType->getConfigPrefix() . '.';
}
/**
......@@ -222,7 +222,7 @@ public static function getIDFromConfigName($config_name, $config_prefix) {
* A SelectQuery object for loading the entity.
*/
protected function buildQuery($ids, $revision_id = FALSE) {
$config_class = $this->entityInfo->getClass();
$config_class = $this->entityType->getClass();
$prefix = $this->getConfigPrefix();
// Get the names of the configuration entities we are going to load.
......@@ -240,7 +240,7 @@ protected function buildQuery($ids, $revision_id = FALSE) {
// Load all of the configuration entities.
$result = array();
foreach ($this->configFactory->loadMultiple($names) as $config) {
$result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType);
$result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityTypeId);
}
return $result;
}
......@@ -249,13 +249,13 @@ protected function buildQuery($ids, $revision_id = FALSE) {
* Implements Drupal\Core\Entity\EntityStorageControllerInterface::create().
*/
public function create(array $values) {
$class = $this->entityInfo->getClass();
$class = $this->entityType->getClass();
$class::preCreate($this, $values);
// Set default language to site default if not provided.
$values += array('langcode' => language_default()->id);
$entity = new $class($values, $this->entityType);
$entity = new $class($values, $this->entityTypeId);
// Mark this entity as new, so isNew() returns TRUE. This does not check
// whether a configuration entity with the same ID (if any) already exists.
$entity->enforceIsNew();
......@@ -287,7 +287,7 @@ public function delete(array $entities) {
return;
}
$entity_class = $this->entityInfo->getClass();
$entity_class = $this->entityType->getClass();
$entity_class::preDelete($this, $entities);
foreach ($entities as $entity) {
$this->invokeHook('predelete', $entity);
......@@ -328,7 +328,7 @@ public function save(EntityInterface $entity) {
// Prevent overwriting an existing configuration file if the entity is new.
if ($entity->isNew() && !$config->isNew()) {
throw new EntityStorageException(String::format('@type entity with ID @id already exists.', array('@type' => $this->entityType, '@id' => $id)));
throw new EntityStorageException(String::format('@type entity with ID @id already exists.', array('@type' => $this->entityTypeId, '@id' => $id)));
}
if (!$config->isNew() && !isset($entity->original)) {
......@@ -389,9 +389,9 @@ public function save(EntityInterface $entity) {
*/
protected function invokeHook($hook, EntityInterface $entity) {
// Invoke the hook.
module_invoke_all($this->entityType . '_' . $hook, $entity);
module_invoke_all($this->entityTypeId . '_' . $hook, $entity);
// Invoke the respective entity-level hook.
module_invoke_all('entity_' . $hook, $entity, $this->entityType);
module_invoke_all('entity_' . $hook, $entity, $this->entityTypeId);
}
/**
......@@ -415,7 +415,7 @@ public function importCreate($name, Config $new_config, Config $old_config) {
* {@inheritdoc}
*/
public function importUpdate($name, Config $new_config, Config $old_config) {
$id = static::getIDFromConfigName($name, $this->entityInfo->getConfigPrefix());
$id = static::getIDFromConfigName($name, $this->entityType->getConfigPrefix());
$entity = $this->load($id);
$entity->setSyncing(TRUE);
$entity->original = clone $entity;
......@@ -436,7 +436,7 @@ public function importUpdate($name, Config $new_config, Config $old_config) {
* {@inheritdoc}
*/
public function importDelete($name, Config $new_config, Config $old_config) {
$id = static::getIDFromConfigName($name, $this->entityInfo->getConfigPrefix());
$id = static::getIDFromConfigName($name, $this->entityType->getConfigPrefix());
$entity = $this->load($id);
$entity->setSyncing(TRUE);
$entity->delete();
......
......@@ -52,8 +52,8 @@ public function __construct(EntityTypeInterface $entity_info, EntityStorageContr
parent::__construct($entity_info, $storage);
// Check if the entity type supports weighting.
if ($this->entityInfo->hasKey('weight')) {
$this->weightKey = $this->entityInfo->getKey('weight');
if ($this->entityType->hasKey('weight')) {
$this->weightKey = $this->entityType->getKey('weight');
}
}
......@@ -106,7 +106,7 @@ public function buildForm(array $form, array &$form_state) {
$form[$this->entitiesKey] = array(
'#type' => 'table',
'#header' => $this->buildHeader(),
'#empty' => t('There is no @label yet.', array('@label' => $this->entityInfo->getLabel())),
'#empty' => t('There is no @label yet.', array('@label' => $this->entityType->getLabel())),
'#tabledrag' => array(
array(
'action' => 'order',
......
......@@ -132,8 +132,8 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C
* Overrides Entity::__construct().
*/
public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) {
$this->entityType = $entity_type;
$this->bundle = $bundle ? $bundle : $this->entityType;
$this->entityTypeId = $entity_type;
$this->bundle = $bundle ? $bundle : $this->entityTypeId;
$this->languages = language_list(Language::STATE_ALL);
foreach ($values as $key => $value) {
......@@ -172,7 +172,7 @@ public function setNewRevision($value = TRUE) {
* {@inheritdoc}
*/
public function isNewRevision() {
return $this->newRevision || ($this->entityInfo()->hasKey('revision') && !$this->getRevisionId());
return $this->newRevision || ($this->getEntityType()->hasKey('revision') && !$this->getRevisionId());
}
/**
......@@ -198,7 +198,7 @@ public function getRevisionId() {
*/
public function isTranslatable() {
// @todo Inject the entity manager and retrieve bundle info from it.
$bundles = entity_get_bundles($this->entityType);
$bundles = entity_get_bundles($this->entityTypeId);
return !empty($bundles[$this->bundle()]['translatable']);
}
......@@ -214,11 +214,11 @@ public function preSaveRevision(EntityStorageControllerInterface $storage_contro
public function getDefinition() {
// @todo: This does not make much sense, so remove once TypedDataInterface
// is removed. See https://drupal.org/node/2002138.
if ($this->bundle() != $this->entityType()) {
$type = 'entity:' . $this->entityType() . ':' . $this->bundle();
if ($this->bundle() != $this->getEntityTypeId()) {
$type = 'entity:' . $this->getEntityTypeId() . ':' . $this->bundle();
}
else {
$type = 'entity:' . $this->entityType();
$type = 'entity:' . $this->getEntityTypeId();
}
return DataDefinition::create($type);
}
......@@ -485,8 +485,8 @@ public function getPropertyDefinition($name) {
*/
public function getPropertyDefinitions() {
if (!isset($this->fieldDefinitions)) {
$bundle = $this->bundle != $this->entityType ? $this->bundle : NULL;
$this->fieldDefinitions = \Drupal::entityManager()->getFieldDefinitions($this->entityType, $bundle);
$bundle = $this->bundle != $this->entityTypeId ? $this->bundle : NULL;
$this->fieldDefinitions = \Drupal::entityManager()->getFieldDefinitions($this->entityTypeId, $bundle);
}
return $this->fieldDefinitions;
}
......@@ -532,11 +532,11 @@ public function isEmpty() {
public function access($operation = 'view', AccountInterface $account = NULL) {
if ($operation == 'create') {
return \Drupal::entityManager()
->getAccessController($this->entityType)
->getAccessController($this->entityTypeId)
->createAccess($this->bundle(), $account);
}
return \Drupal::entityManager()
->getAccessController($this->entityType)
->getAccessController($this->entityTypeId)
->access($this, $operation, $this->activeLangcode, $account);
}
......@@ -716,10 +716,10 @@ public function addTranslation($langcode, array $values = array()) {
// Instantiate a new empty entity so default values will be populated in the
// specified language.
$info = $this->entityInfo();
$info = $this->getEntityType();
$default_values = array($info->getKey('bundle') => $this->bundle, 'langcode' => $langcode);
$entity = \Drupal::entityManager()
->getStorageController($this->entityType())
->getStorageController($this->getEntityTypeId())
->create($default_values);
foreach ($entity as $name => $field) {
......@@ -902,7 +902,7 @@ public function createDuplicate() {
}
$duplicate = clone $this;
$entity_info = $this->entityInfo();
$entity_info = $this->getEntityType();
$duplicate->{$entity_info->getKey('id')}->value = NULL;
// Check if the entity type supports UUIDs and generate a new one if so.
......@@ -955,7 +955,7 @@ public function __clone() {
*/
public function label() {
$label = NULL;
$entity_info = $this->entityInfo();
$entity_info = $this->getEntityType();
// @todo Convert to is_callable() and call_user_func().
if (($label_callback = $entity_info->getLabelCallback()) && function_exists($label_callback)) {
$label = $label_callback($this);
......
......@@ -19,7 +19,7 @@ abstract class ContentEntityConfirmFormBase extends ContentEntityFormController
* {@inheritdoc}
*/
public function getBaseFormID() {
return $this->entity->entityType() . '_confirm_form';
return $this->entity->getEntityTypeId() . '_confirm_form';
}
/**
......
......@@ -50,7 +50,7 @@ public function form(array $form, array &$form_state) {
$entity = $this->entity;
// @todo Exploit the Field API to generate the default widgets for the
// entity fields.
if ($entity->entityInfo()->isFieldable()) {
if ($entity->getEntityType()->isFieldable()) {
field_attach_form($entity, $form, $form_state, $this->getFormLangcode($form_state));
}
......@@ -66,7 +66,7 @@ public function form(array $form, array &$form_state) {
public function validate(array $form, array &$form_state) {
$this->updateFormLangcode($form_state);
$entity = $this->buildEntity($form, $form_state);
$entity_type = $entity->entityType();
$entity_type = $entity->getEntityTypeId();
$entity_langcode = $entity->language()->id;
$violations = array();
......@@ -130,7 +130,7 @@ public function isDefaultFormLangcode(array $form_state) {
*/
public function buildEntity(array $form, array &$form_state) {
$entity = clone $this->entity;
$entity_type = $entity->entityType();
$entity_type = $entity->getEntityTypeId();
$info = \Drupal::entityManager()->getDefinition($entity_type);
// @todo Exploit the Entity Field API to process the submitted field values.
......
......@@ -62,7 +62,7 @@ public static function create(ContainerInterface $container) {
*/
public function view(EntityInterface $_entity, $view_mode = 'full', $langcode = NULL) {
return $this->entityManager
->getViewBuilder($_entity->entityType())
->getViewBuilder($_entity->getEntityTypeId())
->view($_entity, $view_mode, $langcode);
}
......
......@@ -86,10 +86,10 @@ public function __construct(EntityTypeInterface $entity_info, Connection $databa
$this->uuidService = $uuid_service;
// Check if the entity type supports IDs.
$this->idKey = $this->entityInfo->getKey('id');
$this->idKey = $this->entityType->getKey('id');
// Check if the entity type supports UUIDs.
$this->uuidKey = $this->entityInfo->getKey('uuid');
$this->uuidKey = $this->entityType->getKey('uuid');
}
/**
......@@ -121,11 +121,11 @@ public function loadMultiple(array $ids = NULL) {
// Build and execute the query.
$query_result = $this->buildQuery($ids)->execute();
if ($class = $this->entityInfo->getClass()) {
if ($class = $this->entityType->getClass()) {
// We provide the necessary arguments for PDO to create objects of the
// specified entity class.
// @see \Drupal\Core\Entity\EntityInterface::__construct()
$query_result->setFetchMode(\PDO::FETCH_CLASS, $class, array(array(), $this->entityType));
$query_result->setFetchMode(\PDO::FETCH_CLASS, $class, array(array(), $this->entityTypeId));
}
$queried_entities = $query_result->fetchAllAssoc($this->idKey);
}
......@@ -186,7 +186,7 @@ public function deleteRevision($revision_id) {
*/
public function loadByProperties(array $values = array()) {
// Build a query to fetch the entity IDs.
$entity_query = \Drupal::entityQuery($this->entityType);
$entity_query = \Drupal::entityQuery($this->entityTypeId);
$this->buildPropertyQuery($entity_query, $values);
$result = $entity_query->execute();
return $result ? $this->loadMultiple($result) : array();
......@@ -217,12 +217,12 @@ protected function buildPropertyQuery(QueryInterface $entity_query, array $value
* A SelectQuery object for loading the entity.
*/
protected function buildQuery($ids, $revision_id = FALSE) {
$query = $this->database->select($this->entityInfo->getBaseTable(), 'base');
$query = $this->database->select($this->entityType->getBaseTable(), 'base');
$query->addTag($this->entityType . '_load_multiple');
$query->addTag($this->entityTypeId . '_load_multiple');
// Add fields from the {entity} table.
$entity_fields = drupal_schema_fields_sql($this->entityInfo->getBaseTable());
$entity_fields = drupal_schema_fields_sql($this->entityType->getBaseTable());
$query->fields('base', $entity_fields);
if ($ids) {
......@@ -236,10 +236,10 @@ protected function buildQuery($ids, $revision_id = FALSE) {
* {@inheritdoc}
*/
public function create(array $values) {
$entity_class = $this->entityInfo->getClass();
$entity_class = $this->entityType->getClass();
$entity_class::preCreate($this, $values);
$entity = new $entity_class($values, $this->entityType);
$entity = new $entity_class($values, $this->entityTypeId);
// Assign a new UUID if there is none yet.
if ($this->uuidKey && !isset($entity->{$this->uuidKey})) {
......@@ -265,14 +265,14 @@ public function delete(array $entities) {
$transaction = $this->database->startTransaction();
try {
$entity_class = $this->entityInfo->getClass();
$entity_class = $this->entityType->getClass();
$entity_class::preDelete($this, $entities);
foreach ($entities as $entity) {
$this->invokeHook('predelete', $entity);
}
$ids = array_keys($entities);
$this->database->delete($this->entityInfo->getBaseTable())
$this->database->delete($this->entityType->getBaseTable())
->condition($this->idKey, $ids, 'IN')
->execute();
......@@ -288,7 +288,7 @@ public function delete(array $entities) {
}
catch (\Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
watchdog_exception($this->entityTypeId, $e);
throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
}
}
......@@ -301,20 +301,20 @@ public function save(EntityInterface $entity) {
try {
// Load the stored entity, if any.
if (!$entity->isNew() && !isset($entity->original)) {
$entity->original = entity_load_unchanged($this->entityType, $entity->id());
$entity->original = entity_load_unchanged($this->entityTypeId, $entity->id());
}
$entity->preSave($this);
$this->invokeHook('presave', $entity);
if (!$entity->isNew()) {
$return = drupal_write_record($this->entityInfo->getBaseTable(), $entity, $this->idKey);
$return = drupal_write_record($this->entityType->getBaseTable(), $entity, $this->idKey);
$this->resetCache(array($entity->id()));
$entity->postSave($this, TRUE);
$this->invokeHook('update', $entity);
}
else {
$return = drupal_write_record($this->entityInfo->getBaseTable(), $entity);
$return = drupal_write_record($this->entityType->getBaseTable(), $entity);
// Reset general caches, but keep caches specific to certain entities.
$this->resetCache(array());
......@@ -331,7 +331,7 @@ public function save(EntityInterface $entity) {
}
catch (\Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
watchdog_exception($this->entityTypeId, $e);
throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
}
}
......
......@@ -28,7 +28,7 @@ abstract class Entity implements EntityInterface {
*
* @var string
*/
protected $entityType;
protected $entityTypeId;
/**
* Boolean indicating whether the entity should be forced to be new.
......@@ -61,7 +61,7 @@ abstract class Entity implements EntityInterface {
* The type of the entity to create.
*/
public function __construct(array $values, $entity_type) {
$this->entityType = $entity_type;
$this->entityTypeId = $entity_type;
// Set initial values.
foreach ($values as $key => $value) {
$this->$key = $value;
......@@ -99,15 +99,15 @@ public function enforceIsNew($value = TRUE) {
/**
* {@inheritdoc}
*/
public function entityType() {
return $this->entityType;
public function getEntityTypeId() {
return $this->entityTypeId;
}
/**
* {@inheritdoc}
*/
public function bundle() {
return $this->entityType;
return $this->entityTypeId;
}
/**
......@@ -115,7 +115,7 @@ public function bundle() {
*/
public function label() {
$label = NULL;
$entity_info = $this->entityInfo();
$entity_info = $this->getEntityType();
// @todo Convert to is_callable() and call_user_func().
if (($label_callback = $entity_info->getLabelCallback()) && function_exists($label_callback)) {
$label = $label_callback($this);
......@@ -155,7 +155,7 @@ public function label() {
* of the entity, and matching the signature of url().
*/
public function uri($rel = 'canonical') {
$entity_info = $this->entityInfo();
$entity_info = $this->getEntityType();
// The links array might contain URI templates set in annotations.
$link_templates = $this->linkTemplates();
......@@ -181,7 +181,7 @@ public function uri($rel = 'canonical') {
// Pass the entity data to url() so that alter functions do not need to
// look up this entity again.
$uri['options']['entity_type'] = $this->entityType;
$uri['options']['entity_type'] = $this->entityTypeId;
$uri['options']['entity'] = $this;
return $uri;
}
......@@ -189,7 +189,7 @@ public function uri($rel = 'canonical') {
$bundle = $this->bundle();
// A bundle-specific callback takes precedence over the generic one for
// the entity type.
$bundles = entity_get_bundles($this->entityType);
$bundles = entity_get_bundles($this->entityTypeId);
if (isset($bundles[$bundle]['uri_callback'])) {
$uri_callback = $bundles[$bundle]['uri_callback'];
}
......@@ -207,7 +207,7 @@ public function uri($rel = 'canonical') {
// Other relationship types are not supported by this logic.
elseif ($rel == 'canonical') {
$uri = array(
'path' => 'entity/' . $this->entityType . '/' . $this->id(),
'path' => 'entity/' . $this->entityTypeId . '/' . $this->id(),
);
}
else {
......@@ -227,7 +227,7 @@ public function uri($rel = 'canonical') {
* An array of link templates containing route names.
*/
protected function linkTemplates() {
return $this->entityInfo()->getLinkTemplates();
return $this->getEntityType()->getLinkTemplates();
}
/**
......@@ -243,11 +243,11 @@ protected function linkTemplates() {
protected function uriPlaceholderReplacements() {
if (empty($this->uriPlaceholderReplacements)) {
$this->uriPlaceholderReplacements = array(
'{entityType}' => $this->entityType(),
'{entityType}' => $this->getEntityTypeId(),
'{bundle}' => $this->bundle(),
'{id}' => $this->id(),
'{uuid}' => $this->uuid(),
'{' . $this->entityType() . '}' => $this->id(),
'{' . $this->getEntityTypeId() . '}' => $this->id(),
);
}
return $this->uriPlaceholderReplacements;
......@@ -271,11 +271,11 @@ public function uriRelationships() {
public function access($operation = 'view', AccountInterface $account = NULL) {
if ($operation == 'create') {
return \Drupal::entityManager()
->getAccessController($this->entityType)
->getAccessController($this->entityTypeId)
->createAccess($this->bundle(), $account);
}
return \Drupal::entityManager()
->getAccessController($this->entityType)
->getAccessController($this->entityTypeId)
->access($this, $operation, Language::LANGCODE_DEFAULT, $account);
}
......@@ -295,7 +295,7 @@ public function language() {
* {@inheritdoc}
*/
public function save() {
return \Drupal::entityManager()->getStorageController($this->entityType)->save($this);
return \Drupal::entityManager()->getStorageController($this->entityTypeId)->save($this);
}
/**
......@@ -303,7 +303,7 @@ public function save() {
*/
public function delete() {
if (!$this->isNew()) {
\Drupal::entityManager()->getStorageController($this->entityType)->delete(array($this->id() => $this));
\Drupal::entityManager()->getStorageController($this->entityTypeId)->delete(array($this->id() => $this));
}
}
......@@ -312,7 +312,7 @@ public function delete() {
*/
public function createDuplicate() {
$duplicate = clone $this;
$entity_info = $this->entityInfo();
$entity_info = $this->getEntityType();
$duplicate->{$entity_info->getKey('id')} = NULL;
// Check if the entity type supports UUIDs and generate a new one if so.
......@@ -326,8 +326,8 @@ public function createDuplicate() {
/**
* {@inheritdoc}
*/
public function entityInfo() {
return \Drupal::entityManager()->getDefinition($this->entityType());
public function getEntityType() {
return \Drupal::entityManager()->getDefinition($this->getEntityTypeId());
}
/**
......@@ -388,11 +388,11 @@ public function referencedEntities() {
*/
protected function onSaveOrDelete() {
$referenced_entities = array(
$this->entityType() => array($this->id() => $this),
$this->getEntityTypeId() => array($this->id() => $this),
);
foreach ($this->referencedEntities() as $referenced_entity) {
$referenced_entities[$referenced_entity->entityType()][$referenced_entity->id()] = $referenced_entity;
$referenced_entities[$referenced_entity->getEntityTypeId()][$referenced_entity->id()] = $referenced_entity;
}
foreach ($referenced_entities as $entity_type => $entities) {
......
......@@ -27,18 +27,18 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces
protected $accessCache = array();
/**
* The entity type of the access controller instance.
* The entity type ID of the access controller instance.
*
* @var string
*/
protected $entityType;
protected $entityTypeId;
/**
* The entity info array.
* Information about the entity type.
*
* @var \Drupal\Core\Entity\EntityTypeInterface
*/
protected $entityInfo;
protected $entityType;
/**
* Constructs an access controller instance.
......@@ -47,8 +47,8 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces
* The entity info for the entity type.
*/
public function __construct(EntityTypeInterface $entity_info) {
$this->entityType = $entity_info->id();
$this->entityInfo = $entity_info;
$this->entityTypeId = $entity_info->id();
$this->entityType = $entity_info;
}