class ConfigDependencies implements ContainerInjectionInterface (View source)

internal  
 

Calculates rest resource config dependencies.

Properties

protected string[] $formatProviders

The serialization format providers, keyed by format.

protected string[] $authProviders

The authentication providers, keyed by ID.

Methods

__construct(array $format_providers, array $auth_providers)

Creates a new ConfigDependencies instance.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

string[][]
calculateDependencies(RestResourceConfigInterface $rest_config)

Calculates dependencies of a specific rest resource configuration.

bool
onDependencyRemoval(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

bool
onDependencyRemovalForMethodGranularity(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

bool
onDependencyRemovalForResourceGranularity(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

Details

__construct(array $format_providers, array $auth_providers)

Creates a new ConfigDependencies instance.

Parameters

array $format_providers

The serialization format providers, keyed by format.

array $auth_providers

The authentication providers, keyed by ID.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

string[][] calculateDependencies(RestResourceConfigInterface $rest_config)

Calculates dependencies of a specific rest resource configuration.

This function returns dependencies in a non-sorted, non-unique manner. It is therefore the caller's responsibility to sort and remove duplicates from the result prior to saving it with the configuration or otherwise using it in a way that requires that. For example, \Drupal\rest\Entity\RestResourceConfig::calculateDependencies() does this via its \Drupal\Core\Entity\DependencyTrait::addDependency() method.

Parameters

RestResourceConfigInterface $rest_config

The rest configuration.

Return Value

string[][]

Dependencies keyed by dependency type.

See also

RestResourceConfig::calculateDependencies

bool onDependencyRemoval(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

Parameters

RestResourceConfigInterface $rest_config

The rest configuration.

array $dependencies

An array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.

Return Value

bool

TRUE if the entity has been changed as a result, FALSE if not.

See also

ConfigEntityInterface::onDependencyRemoval

protected bool onDependencyRemovalForMethodGranularity(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

Parameters

RestResourceConfigInterface $rest_config

The rest configuration.

array $dependencies

An array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.

Return Value

bool

TRUE if the entity has been changed as a result, FALSE if not.

protected bool onDependencyRemovalForResourceGranularity(RestResourceConfigInterface $rest_config, array $dependencies)

Informs the entity that entities it depends on will be deleted.

Parameters

RestResourceConfigInterface $rest_config

The rest configuration.

array $dependencies

An array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.

Return Value

bool

TRUE if the entity has been changed as a result, FALSE if not.