-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Deprecate scope concept #14984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,9 +68,9 @@ public function getProxyFactoryCode(Definition $definition, $id) | |
{ | ||
$instantiation = 'return'; | ||
|
||
if (ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) { | ||
if ($definition->isShared() && ContainerInterface::SCOPE_CONTAINER === $definition->getScope(false)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will need to bump the DependencyInjection component version in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to check if the method exists. |
||
$instantiation .= " \$this->services['$id'] ="; | ||
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) { | ||
} elseif ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) { | ||
$instantiation .= " \$this->services['$id'] = \$this->scopedServices['$scope']['$id'] ="; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file=""> | ||
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file=""> | ||
<factory class="Full\Qualified\FactoryClass" method="get"/> | ||
</definition> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to show examples for YML and XML as well as those formats are the most used ones for configuring services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, the structure should be?
Before:
After
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me