Skip to content
Snippets Groups Projects

Issue #3494839: AutowireTrait allows ContainerInjectionInterface classes to be autowired

Files
32
@@ -5,7 +5,6 @@ namespace Drupal\schemadotorg_diagram\Controller;
@@ -5,7 +5,6 @@ namespace Drupal\schemadotorg_diagram\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Controller\ControllerBase;
use Drupal\node\NodeInterface;
use Drupal\node\NodeInterface;
use Drupal\schemadotorg_diagram\SchemaDotOrgDiagramInterface;
use Drupal\schemadotorg_diagram\SchemaDotOrgDiagramInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
/**
* Returns responses for Schema.org Diagram.
* Returns responses for Schema.org Diagram.
@@ -13,18 +12,14 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -13,18 +12,14 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class SchemaDotOrgDiagramController extends ControllerBase {
class SchemaDotOrgDiagramController extends ControllerBase {
/**
/**
* The Schema.org Diagram service.
* Constructs a SchemaDotOrgDiagramController objects.
*/
*
protected SchemaDotOrgDiagramInterface $schemaDiagram;
* @param \Drupal\schemadotorg_diagram\SchemaDotOrgDiagramInterface $schemaDiagram
* The Schema.org Diagram service.
/**
* {@inheritdoc}
*/
*/
public static function create(ContainerInterface $container): static {
public function __construct(
$instance = parent::create($container);
protected SchemaDotOrgDiagramInterface $schemaDiagram,
$instance->schemaDiagram = $container->get('schemadotorg_diagram');
) {}
return $instance;
}
/**
/**
* Builds the response containing the Schema.org diagrams.
* Builds the response containing the Schema.org diagrams.
Loading