class Container in Drupal 8
Same name in this branch
- 8 core/lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
- 8 core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container
- 8 core/lib/Drupal/Core/Render/Element/Container.php \Drupal\Core\Render\Element\Container
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
Extends the Drupal container to set the service ID on the created object.
Hierarchy
Expanded class hierarchy of Container
22 files declare their use of Container
- BlockPageVariantTest.php in core/
modules/ block/ tests/ src/ Unit/ Plugin/ DisplayVariant/ BlockPageVariantTest.php - CacheTagsInvalidatorTest.php in core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheTagsInvalidatorTest.php - ContainerTest.php in core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ ContainerTest.php - DefaultMenuLinkTreeManipulatorsTest.php in core/
tests/ Drupal/ Tests/ Core/ Menu/ DefaultMenuLinkTreeManipulatorsTest.php - DependencySerializationTest.php in core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ DependencySerializationTest.php - Contains \Drupal\Tests\Core\DependencyInjection\DependencySerializationTest.
2 string references to 'Container'
- field.field.taxonomy_term.forums.forum_container.yml in core/
modules/ forum/ config/ optional/ field.field.taxonomy_term.forums.forum_container.yml - core/modules/forum/config/optional/field.field.taxonomy_term.forums.forum_container.yml
- SearchExcerptTest::testSearchExcerptSimplified in core/
modules/ search/ tests/ src/ Kernel/ SearchExcerptTest.php - Tests search_excerpt() with search keywords matching simplified words.
File
- core/
lib/ Drupal/ Core/ DependencyInjection/ Container.php, line 10
Namespace
Drupal\Core\DependencyInjectionView source
class Container extends DrupalContainer {
/**
* {@inheritdoc}
*/
public function set($id, $service) {
parent::set($id, $service);
// Ensure that the _serviceId property is set on synthetic services as well.
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
$this->services[$id]->_serviceId = $id;
}
}
/**
* {@inheritdoc}
*/
public function __sleep() {
assert(FALSE, 'The container was serialized.');
return array_keys(get_object_vars($this));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Container:: |
protected | property | The aliases of the container. | |
Container:: |
protected | property | Whether the container parameters can still be changed. | |
Container:: |
protected | property | The currently loading services. | |
Container:: |
protected | property | The parameters of the container. | |
Container:: |
protected | property | The instantiated private services. | |
Container:: |
protected | property | The service definitions of the container. | |
Container:: |
protected | property | The instantiated services. | |
Container:: |
protected | function | Creates a service from a service definition. | 1 |
Container:: |
public | function | Gets a service. | 2 |
Container:: |
protected | function | Provides alternatives for a given array and key. | |
Container:: |
public | function | Gets a parameter. | |
Container:: |
protected | function | Provides alternatives in case a parameter was not found. | |
Container:: |
protected | function | Provides alternatives in case a service was not found. | |
Container:: |
public | function | Gets all defined service IDs. | |
Container:: |
public | function | Returns true if the given service is defined. | |
Container:: |
public | function | Checks if a parameter exists. | |
Container:: |
public | function | ||
Container:: |
public | function | Resets shared services from the container. | |
Container:: |
protected | function | Resolves arguments that represent services or variables to the real values. | 1 |
Container:: |
public | function |
Sets a service. Overrides Container:: |
|
Container:: |
public | function | Sets a parameter. | |
Container:: |
private | function | Ensure that cloning doesn't work. | |
Container:: |
public | function | Constructs a new Container instance. | 1 |
Container:: |
public | function |