Drupal 8  8.0.2
EntityResolverManager Class Reference

Public Member Functions

 __construct (EntityManagerInterface $entity_manager, ClassResolverInterface $class_resolver)
 
 setRouteOptions (Route $route)
 

Protected Member Functions

 getControllerClass (array $defaults)
 
 setParametersFromReflection ($controller, Route $route)
 
 setParametersFromEntityInformation (Route $route)
 
 getEntityTypes ()
 

Protected Attributes

 $entityManager
 
 $classResolver
 

Detailed Description

Sets the entity route parameter converter options automatically.

If controllers of routes with route parameters, type-hint the parameters with an entity interface, upcasting is done automatically.

Constructor & Destructor Documentation

__construct ( EntityManagerInterface  $entity_manager,
ClassResolverInterface  $class_resolver 
)

Constructs a new EntityRouteAlterSubscriber.

Parameters
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.
\Drupal\Core\DependencyInjection\ClassResolverInterface$class_resolverThe class resolver.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

getControllerClass ( array  $defaults)
protected

Gets the controller class using route defaults.

By design we cannot support all possible routes, but just the ones which use the defaults provided by core, which are _controller and _form.

Rather than creating an instance of every controller determine the class and method that would be used. This is not possible for the service:method notation as the runtime container does not allow static introspection.

See Also
::getControllerFromDefinition()
::getInstanceFromDefinition()
Parameters
array$defaultsThe default values provided by the route.
Returns
string|null Returns the controller class, otherwise NULL.

Referenced by EntityResolverManager\setRouteOptions().

Here is the caller graph for this function:

getEntityTypes ( )
protected

Gets the list of all entity types.

Returns
[]

References Drupal\entityManager().

Referenced by EntityResolverManager\setParametersFromEntityInformation(), and EntityResolverManager\setParametersFromReflection().

Here is the call graph for this function:

Here is the caller graph for this function:

setParametersFromEntityInformation ( Route  $route)
protected

Sets the upcasting information using the entity* route defaults.

Supports the '_entity_view' and '_entity_form' route defaults.

Parameters
\Symfony\Component\Routing\Route$routeThe route object.

References EntityResolverManager\getEntityTypes().

Referenced by EntityResolverManager\setRouteOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

setParametersFromReflection (   $controller,
Route  $route 
)
protected

Sets the upcasting information using reflection.

Parameters
string | array$controllerA PHP callable representing the controller.
\Symfony\Component\Routing\Route$routeThe route object to populate without upcasting information.
Returns
bool Returns TRUE if the upcasting parameters could be set, FALSE otherwise.

References EntityResolverManager\getEntityTypes().

Referenced by EntityResolverManager\setRouteOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

setRouteOptions ( Route  $route)

Set the upcasting route objects.

Parameters
\Symfony\Component\Routing\Route$routeThe route object to add the upcasting information onto.

References EntityResolverManager\getControllerClass(), EntityResolverManager\setParametersFromEntityInformation(), and EntityResolverManager\setParametersFromReflection().

Here is the call graph for this function:


The documentation for this class was generated from the following file: