Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DependencyInjection] deprecate access to private shared services.#19146

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromhhamon:private-services-fix
Jun 29, 2016

Conversation

@hhamon
Copy link
Contributor

@hhamonhhamon commentedJun 22, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#19117
LicenseMIT
Doc PR~

HeahDude, jonny-no1, and theofidry reacted with thumbs up emoji
@hhamon
Copy link
ContributorAuthor

Looks like fabbot gives a false positive!

@fabpot
Copy link
Member

But tests are truly broken :)


* Requesting a private shared service with the`get()` method of the`Container`
class is no longer supported and will raise an exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You also need to add a note in the component CHANGELOG file.

@fabpot
Copy link
Member

I would have implemented this feature in a different way by renaming internally private services so that their original name is not available from the container (this is what we are doing for anonymous services for instance).

@xabbuh
Copy link
Member

I think it's a good idea to switch to generated ids in 4.0. For now I like this approach as it allows users to fix their applications more smoothly.

sstok reacted with thumbs up emoji

$id =$lcId;
}else {
if (isset($this->privates[$id])) {
@trigger_error(sprintf('Checking for the existence of the private service "%s" is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0. An exception will be thrown instead in Symfony 4.0.',$id),E_USER_DEPRECATED);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why throw an exception in this case? If you check a private service for existence, the method should returnfalse, right?

sstok reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes it makes more sense!

@hhamonhhamon changed the title[DependencyInjection] deprecate access to private shared services.[WIP] [DependencyInjection] deprecate access to private shared services.Jun 23, 2016
@fabpot
Copy link
Member

@xabbuh Fair enough, let's keep the current approach for now.

@hhamon
Copy link
ContributorAuthor

I'll update the code later today to reflect your comments.

}

if (isset($this->privates[$id])) {
@trigger_error(sprintf('Resetting the private service "%s" from outside of the container is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0. An exception will be thrown instead in Symfony 4.0.',$id),E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

. and is part of new sentence part and should start with an uppercase 👍

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Where is that?

@stof
Copy link
Member

@fabpot generated ids are a good idea for 4.0 indeed, but this cannot be done for deprecations. If we want to switch to generated ids already, we would have to build another feature to to store a mapping between shared private service ids and their generated ids, to retrieve them this way and trigger a deprecation, which would again look like this approach.

@hhamonhhamonforce-pushed theprivate-services-fix branch 3 times, most recently from18ba656 to19f3c66CompareJune 23, 2016 19:41
@hhamon
Copy link
ContributorAuthor

I don't understand why the tests suite fails on PHP 5.5 and HHVM. The failing test in the ProxyManager Bridge passes on my machine with PHP 5.5.36...

return;
}
if (isset($this->privates[$id])) {
@trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0. An exception will be thrown instead in Symfony 4.0.',$id),E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I won't necessarily throw an exception as it depends on the$invalidBehavior value.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yes that's right!

@GuilhemN
Copy link
Contributor

The tests are missing for theContainerBuilder :)

@hhamon
Copy link
ContributorAuthor

Thanks @Ener-Getick! I'm going to add some ;)

@hhamonhhamonforce-pushed theprivate-services-fix branch 2 times, most recently froma43a537 to13edce2CompareJune 27, 2016 11:03
@hhamonhhamon changed the title[WIP] [DependencyInjection] deprecate access to private shared services.[DependencyInjection] deprecate access to private shared services.Jun 27, 2016
@hhamon
Copy link
ContributorAuthor

I guess it's now ready for another round of reviews if tests pass.

@hhamonhhamonforce-pushed theprivate-services-fix branch from13edce2 to326cbebCompareJune 27, 2016 11:13
@nicolas-grekas
Copy link
Member

👍 (fabbot fails on a fixture, unrelated)

no longer supported. Only public services can be set or unset.

* Checking the existence of a private service with the`Container::has()`
method is no longer supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's not that it is not supported anymore but more that it's going to return false.

@fabpot
Copy link
Member

Apart from my minor comment, 👍

@hhamonhhamonforce-pushed theprivate-services-fix branch from326cbeb to4ed70c4CompareJune 28, 2016 07:16
@hhamon
Copy link
ContributorAuthor

@fabpot fixed! CI is running ;)

@hhamon
Copy link
ContributorAuthor

Good to go!

@fabpot
Copy link
Member

Thank you@hhamon.

@fabpotfabpot merged commit4ed70c4 intosymfony:masterJun 29, 2016
fabpot added a commit that referenced this pull requestJun 29, 2016
…ed services. (hhamon)This PR was merged into the 3.2-dev branch.Discussion----------[DependencyInjection] deprecate access to private shared services.| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#19117| License       | MIT| Doc PR        | ~Commits-------4ed70c4 [DependencyInjection] deprecate access to private shared services. Fixes issue#19117.
@fabpotfabpot mentioned this pull requestOct 27, 2016
@hhamonhhamon deleted the private-services-fix branchFebruary 22, 2017 13:13
fabpot added a commit that referenced this pull requestJul 17, 2017
…rvices (ro0NL)This PR was merged into the 4.0-dev branch.Discussion----------[DI] Removed deprecated setting private/pre-defined services| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | yes| Deprecations? | no| Tests pass?   | yes| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->See#21533,#19708 and#19146@nicolas-grekas privates should be excluded from `getServiceIds` right? i also wondered.. did we forget to deprecate checking privates with `initialized()`?Commits-------9f96952 [DI] Removed deprecated setting private/pre-defined services
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@hhamon@fabpot@xabbuh@stof@GuilhemN@nicolas-grekas@javiereguiluz@sstok@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp