Unverified Commit c2226f75 authored by alexpott's avatar alexpott

Issue #3010805 by amateescu: Fix misleading variable names in EntityTypeManagerInterface

parent 6ca0cd27
......@@ -63,8 +63,8 @@ public function getDefinition($entity_type_id, $exception_on_invalid = TRUE) {
*
* @see https://www.drupal.org/node/2549139
*/
public function hasHandler($entity_type, $handler_type) {
return $this->container->get('entity_type.manager')->hasHandler($entity_type, $handler_type);
public function hasHandler($entity_type_id, $handler_type) {
return $this->container->get('entity_type.manager')->hasHandler($entity_type_id, $handler_type);
}
/**
......@@ -75,8 +75,8 @@ public function hasHandler($entity_type, $handler_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getStorage($entity_type) {
return $this->container->get('entity_type.manager')->getStorage($entity_type);
public function getStorage($entity_type_id) {
return $this->container->get('entity_type.manager')->getStorage($entity_type_id);
}
/**
......@@ -88,8 +88,8 @@ public function getStorage($entity_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getListBuilder($entity_type) {
return $this->container->get('entity_type.manager')->getListBuilder($entity_type);
public function getListBuilder($entity_type_id) {
return $this->container->get('entity_type.manager')->getListBuilder($entity_type_id);
}
/**
......@@ -101,8 +101,8 @@ public function getListBuilder($entity_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getFormObject($entity_type, $operation) {
return $this->container->get('entity_type.manager')->getFormObject($entity_type, $operation);
public function getFormObject($entity_type_id, $operation) {
return $this->container->get('entity_type.manager')->getFormObject($entity_type_id, $operation);
}
/**
......@@ -114,8 +114,8 @@ public function getFormObject($entity_type, $operation) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getRouteProviders($entity_type) {
return $this->container->get('entity_type.manager')->getRouteProviders($entity_type);
public function getRouteProviders($entity_type_id) {
return $this->container->get('entity_type.manager')->getRouteProviders($entity_type_id);
}
/**
......@@ -127,8 +127,8 @@ public function getRouteProviders($entity_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getViewBuilder($entity_type) {
return $this->container->get('entity_type.manager')->getViewBuilder($entity_type);
public function getViewBuilder($entity_type_id) {
return $this->container->get('entity_type.manager')->getViewBuilder($entity_type_id);
}
/**
......@@ -140,8 +140,8 @@ public function getViewBuilder($entity_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getAccessControlHandler($entity_type) {
return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type);
public function getAccessControlHandler($entity_type_id) {
return $this->container->get('entity_type.manager')->getAccessControlHandler($entity_type_id);
}
/**
......@@ -152,8 +152,8 @@ public function getAccessControlHandler($entity_type) {
*
* @see https://www.drupal.org/node/2549139
*/
public function getHandler($entity_type, $handler_type) {
return $this->container->get('entity_type.manager')->getHandler($entity_type, $handler_type);
public function getHandler($entity_type_id, $handler_type) {
return $this->container->get('entity_type.manager')->getHandler($entity_type_id, $handler_type);
}
/**
......
......@@ -155,8 +155,8 @@ public function useCaches($use_caches = FALSE) {
/**
* {@inheritdoc}
*/
public function hasHandler($entity_type, $handler_type) {
if ($definition = $this->getDefinition($entity_type, FALSE)) {
public function hasHandler($entity_type_id, $handler_type) {
if ($definition = $this->getDefinition($entity_type_id, FALSE)) {
return $definition->hasHandlerClass($handler_type);
}
......@@ -166,23 +166,23 @@ public function hasHandler($entity_type, $handler_type) {
/**
* {@inheritdoc}
*/
public function getStorage($entity_type) {
return $this->getHandler($entity_type, 'storage');
public function getStorage($entity_type_id) {
return $this->getHandler($entity_type_id, 'storage');
}
/**
* {@inheritdoc}
*/
public function getListBuilder($entity_type) {
return $this->getHandler($entity_type, 'list_builder');
public function getListBuilder($entity_type_id) {
return $this->getHandler($entity_type_id, 'list_builder');
}
/**
* {@inheritdoc}
*/
public function getFormObject($entity_type, $operation) {
if (!$class = $this->getDefinition($entity_type, TRUE)->getFormClass($operation)) {
throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation));
public function getFormObject($entity_type_id, $operation) {
if (!$class = $this->getDefinition($entity_type_id, TRUE)->getFormClass($operation)) {
throw new InvalidPluginDefinitionException($entity_type_id, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type_id, $operation));
}
$form_object = $this->classResolver->getInstanceFromDefinition($class);
......@@ -200,46 +200,46 @@ public function getFormObject($entity_type, $operation) {
/**
* {@inheritdoc}
*/
public function getRouteProviders($entity_type) {
if (!isset($this->handlers['route_provider'][$entity_type])) {
$route_provider_classes = $this->getDefinition($entity_type, TRUE)->getRouteProviderClasses();
public function getRouteProviders($entity_type_id) {
if (!isset($this->handlers['route_provider'][$entity_type_id])) {
$route_provider_classes = $this->getDefinition($entity_type_id, TRUE)->getRouteProviderClasses();
foreach ($route_provider_classes as $type => $class) {
$this->handlers['route_provider'][$entity_type][$type] = $this->createHandlerInstance($class, $this->getDefinition($entity_type));
$this->handlers['route_provider'][$entity_type_id][$type] = $this->createHandlerInstance($class, $this->getDefinition($entity_type_id));
}
}
return isset($this->handlers['route_provider'][$entity_type]) ? $this->handlers['route_provider'][$entity_type] : [];
return isset($this->handlers['route_provider'][$entity_type_id]) ? $this->handlers['route_provider'][$entity_type_id] : [];
}
/**
* {@inheritdoc}
*/
public function getViewBuilder($entity_type) {
return $this->getHandler($entity_type, 'view_builder');
public function getViewBuilder($entity_type_id) {
return $this->getHandler($entity_type_id, 'view_builder');
}
/**
* {@inheritdoc}
*/
public function getAccessControlHandler($entity_type) {
return $this->getHandler($entity_type, 'access');
public function getAccessControlHandler($entity_type_id) {
return $this->getHandler($entity_type_id, 'access');
}
/**
* {@inheritdoc}
*/
public function getHandler($entity_type, $handler_type) {
if (!isset($this->handlers[$handler_type][$entity_type])) {
$definition = $this->getDefinition($entity_type);
public function getHandler($entity_type_id, $handler_type) {
if (!isset($this->handlers[$handler_type][$entity_type_id])) {
$definition = $this->getDefinition($entity_type_id);
$class = $definition->getHandlerClass($handler_type);
if (!$class) {
throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a %s handler.', $entity_type, $handler_type));
throw new InvalidPluginDefinitionException($entity_type_id, sprintf('The "%s" entity type did not specify a %s handler.', $entity_type_id, $handler_type));
}
$this->handlers[$handler_type][$entity_type] = $this->createHandlerInstance($class, $definition);
$this->handlers[$handler_type][$entity_type_id] = $this->createHandlerInstance($class, $definition);
}
return $this->handlers[$handler_type][$entity_type];
return $this->handlers[$handler_type][$entity_type_id];
}
/**
......
......@@ -13,19 +13,19 @@ interface EntityTypeManagerInterface extends PluginManagerInterface, CachedDisco
/**
* Creates a new access control handler instance.
*
* @param string $entity_type
* The entity type for this access control handler.
* @param string $entity_type_id
* The entity type ID for this access control handler.
*
* @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface
* A access control handler instance.
*/
public function getAccessControlHandler($entity_type);
public function getAccessControlHandler($entity_type_id);
/**
* Creates a new storage instance.
*
* @param string $entity_type
* The entity type for this storage.
* @param string $entity_type_id
* The entity type ID for this storage.
*
* @return \Drupal\Core\Entity\EntityStorageInterface
* A storage instance.
......@@ -35,65 +35,65 @@ public function getAccessControlHandler($entity_type);
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* Thrown if the storage handler couldn't be loaded.
*/
public function getStorage($entity_type);
public function getStorage($entity_type_id);
/**
* Creates a new view builder instance.
*
* @param string $entity_type
* The entity type for this view builder.
* @param string $entity_type_id
* The entity type ID for this view builder.
*
* @return \Drupal\Core\Entity\EntityViewBuilderInterface
* A view builder instance.
*/
public function getViewBuilder($entity_type);
public function getViewBuilder($entity_type_id);
/**
* Creates a new entity list builder.
*
* @param string $entity_type
* The entity type for this list builder.
* @param string $entity_type_id
* The entity type ID for this list builder.
*
* @return \Drupal\Core\Entity\EntityListBuilderInterface
* An entity list builder instance.
*/
public function getListBuilder($entity_type);
public function getListBuilder($entity_type_id);
/**
* Creates a new form instance.
*
* @param string $entity_type
* The entity type for this form.
* @param string $entity_type_id
* The entity type ID for this form.
* @param string $operation
* The name of the operation to use, e.g., 'default'.
*
* @return \Drupal\Core\Entity\EntityFormInterface
* A form instance.
*/
public function getFormObject($entity_type, $operation);
public function getFormObject($entity_type_id, $operation);
/**
* Gets all route provider instances.
*
* @param string $entity_type
* The entity type for this route providers.
* @param string $entity_type_id
* The entity type ID for the route providers.
*
* @return \Drupal\Core\Entity\Routing\EntityRouteProviderInterface[]
*/
public function getRouteProviders($entity_type);
public function getRouteProviders($entity_type_id);
/**
* Checks whether a certain entity type has a certain handler.
*
* @param string $entity_type
* The name of the entity type.
* @param string $entity_type_id
* The ID of the entity type.
* @param string $handler_type
* The name of the handler.
*
* @return bool
* Returns TRUE if the entity type has the handler, else FALSE.
*/
public function hasHandler($entity_type, $handler_type);
public function hasHandler($entity_type_id, $handler_type);
/**
* Returns a handler instance for the given entity type and handler.
......@@ -105,8 +105,8 @@ public function hasHandler($entity_type, $handler_type);
* although as the handler is common to all entities of the same type,
* any data that is per-entity should be keyed by the entity ID.
*
* @param string $entity_type
* The entity type for this handler.
* @param string $entity_type_id
* The entity type ID for this handler.
* @param string $handler_type
* The handler type to create an instance for.
*
......@@ -115,7 +115,7 @@ public function hasHandler($entity_type, $handler_type);
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
*/
public function getHandler($entity_type, $handler_type);
public function getHandler($entity_type_id, $handler_type);
/**
* Creates new handler instance.
......
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