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

[Bridge\ProxyManager] Dont call __destruct() on non-instantiated services#23729

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:2.7fromnicolas-grekas:proxy-lazy-destruct
Aug 3, 2017

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedJul 31, 2017
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#23813
LicenseMIT
Doc PR-

While working on making#23678 green, I discovered that if a lazy service implements__destruct, then that service is not lazy anymore: it is created at destruct time.
That behavior is documented atOcramius/ProxyManager#258 (+related issues).

While I may understand why this behavior is the default for ProxyManager, it does not fit our "lazy-services" use case to me. Typically, nobody wants a database connection to be created to destruct the uninitialized lazy-proxy.

Blocks#23678

shustrik reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to the2.7 milestoneJul 31, 2017
@nicolas-grekasnicolas-grekasforce-pushed theproxy-lazy-destruct branch 3 times, most recently fromc366fc7 to6fb67d5CompareJuly 31, 2017 13:32
@nicolas-grekasnicolas-grekas changed the title[Bridge\ProxyManager] Dont call __destruct() on non-instanciated services[Bridge\ProxyManager] Dont call __destruct() on non-instantiated servicesJul 31, 2017
/**
* {@inheritdoc}
*/
protected function getGenerator() : ProxyGeneratorInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't use feature from PHP 7 on branch that supports version 5.5

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

@nicolas-grekasnicolas-grekasforce-pushed theproxy-lazy-destruct branch 8 times, most recently from6baa81f tob98fc0aCompareJuly 31, 2017 15:03
*/
class LazyLoadingValueHolderFactoryV1 extends BaseFactory
{
private $generatorV1;
Copy link
Member

Choose a reason for hiding this comment

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

why does it have a different name here ? Except for the property name, the code is the same in v1 and V2.

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasAug 1, 2017
edited
Loading

Choose a reason for hiding this comment

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

Because in v0.4, the property exists and is protected, thus can't be made private...

Copy link
Member

Choose a reason for hiding this comment

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

we could just use a name available in both versions

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit2d79ffa intosymfony:2.7Aug 3, 2017
fabpot added a commit that referenced this pull requestAug 3, 2017
…tiated services (nicolas-grekas)This PR was merged into the 2.7 branch.Discussion----------[Bridge\ProxyManager] Dont call __destruct() on non-instantiated services| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -While working on making#23678 green, I discovered that if a lazy service implements `__destruct`, then that service is not lazy anymore: it is created at destruct time.That behavior is documented atOcramius/ProxyManager#258 (+related issues).While I may understand why this behavior is the default for ProxyManager, it does not fit our "lazy-services" use case to me. Typically, nobody wants a database connection to be created to destruct the uninitialized lazy-proxy.Blocks#23678Commits-------2d79ffa [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services
@nicolas-grekasnicolas-grekas deleted the proxy-lazy-destruct branchAugust 5, 2017 21:04
This was referencedAug 28, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@stloydstloydstloyd left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@fabpot@stloyd@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp