class 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
| Title Sort descending | Modifiers | Object type | Summary | 
|---|---|---|---|
| SetterInjection::$service | protected | property | The injected service. | 
| SetterInjection::greet | public | function | Get the simple greeting from the service. | 
| SetterInjection::setter | public | function | SetterInjection constructor. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.