Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
fffa8a25
Commit
fffa8a25
authored
1 year ago
by
Dave Long
Browse files
Options
Downloads
Plain Diff
Merge branch '3394870-allow-controller-service' into '11.x'
Resolve
#3394870
"Allow controller service" See merge request
!5034
parents
905415d9
f58054b1
No related branches found
No related tags found
No related merge requests found
Pipeline
#33390
failed
1 year ago
Stage: 🏗️ Build
Stage: 🪄 Lint
Stage: 🗜️ Test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/Controller/ControllerBase.php
+16
-1
16 additions, 1 deletion
core/lib/Drupal/Core/Controller/ControllerBase.php
core/modules/node/src/Controller/NodeController.php
+0
-11
0 additions, 11 deletions
core/modules/node/src/Controller/NodeController.php
with
16 additions
and
12 deletions
core/lib/Drupal/Core/Controller/ControllerBase.php
+
16
−
1
View file @
fffa8a25
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
use
Drupal\Core\Routing\RedirectDestinationTrait
;
use
Drupal\Core\Routing\RedirectDestinationTrait
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\Url
;
use
Drupal\Core\Url
;
use
Symfony\Component\DependencyInjection\Attribute\Autowire
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\Core\Messenger\MessengerTrait
;
use
Drupal\Core\Messenger\MessengerTrait
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
...
@@ -106,7 +107,21 @@ abstract class ControllerBase implements ContainerInjectionInterface {
...
@@ -106,7 +107,21 @@ abstract class ControllerBase implements ContainerInjectionInterface {
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
static
function
create
(
ContainerInterface
$container
)
{
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
();
$args
=
[];
if
(
method_exists
(
static
::
class
,
'__construct'
))
{
$constructor
=
new
\ReflectionMethod
(
static
::
class
,
'__construct'
);
foreach
(
$constructor
->
getParameters
()
as
$parameter
)
{
$type
=
(
string
)
$parameter
->
getType
();
foreach
(
$parameter
->
getAttributes
(
Autowire
::
class
)
as
$attribute
)
{
$type
=
(
string
)
$attribute
->
newInstance
()
->
value
;
}
$args
[]
=
$container
->
get
(
$type
);
}
}
return
new
static
(
...
$args
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
core/modules/node/src/Controller/NodeController.php
+
0
−
11
View file @
fffa8a25
...
@@ -57,17 +57,6 @@ public function __construct(DateFormatterInterface $date_formatter, RendererInte
...
@@ -57,17 +57,6 @@ public function __construct(DateFormatterInterface $date_formatter, RendererInte
$this
->
entityRepository
=
$entity_repository
;
$this
->
entityRepository
=
$entity_repository
;
}
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'date.formatter'
),
$container
->
get
(
'renderer'
),
$container
->
get
(
'entity.repository'
)
);
}
/**
/**
* Displays add content links for available content types.
* Displays add content links for available content types.
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment