class SetterInjection in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/new_dependency_test/src/SetterInjection.php \Drupal\new_dependency_test\SetterInjection
- 9 core/modules/system/tests/modules/new_dependency_test/src/SetterInjection.php \Drupal\new_dependency_test\SetterInjection
Generic service which uses setter injection.
Hierarchy
- class \Drupal\new_dependency_test\SetterInjection
Expanded class hierarchy of SetterInjection
1 string reference to 'SetterInjection'
- new_dependency_test.services.yml in core/
modules/ system/ tests/ modules/ new_dependency_test/ new_dependency_test.services.yml - core/modules/system/tests/modules/new_dependency_test/new_dependency_test.services.yml
1 service uses SetterInjection
- new_dependency_test.setter_injection in core/
modules/ system/ tests/ modules/ new_dependency_test/ new_dependency_test.services.yml - Drupal\new_dependency_test\SetterInjection
File
- core/
modules/ system/ tests/ modules/ new_dependency_test/ src/ SetterInjection.php, line 10
Namespace
Drupal\new_dependency_testView source
class SetterInjection {
/**
* The injected service.
*
* @var \Drupal\new_dependency_test_with_service\NewService
*/
protected $service;
/**
* SetterInjection constructor.
*
* @param \Drupal\new_dependency_test_with_service\NewService $service
* The service of the new module.
*/
public function setter(NewService $service) {
$this->service = $service;
}
/**
* Get the simple greeting from the service.
*
* @return string
* The greeting.
*/
public function greet() {
return $this->service
->greet();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SetterInjection:: |
protected | property | The injected service. | |
SetterInjection:: |
public | function | Get the simple greeting from the service. | |
SetterInjection:: |
public | function | SetterInjection constructor. |