Skip to content

"Lazy" property in Service annotation: Define service as lazy#223

Closed
alber999 wants to merge 13 commits into
schmittjoh:masterfrom
alber999:master
Closed

"Lazy" property in Service annotation: Define service as lazy#223
alber999 wants to merge 13 commits into
schmittjoh:masterfrom
alber999:master

Conversation

@alber999
Copy link
Copy Markdown

Wouldn't it be nice to define lazy services in Service annotation?

/**
 * @Service("my_service", lazy=true)
 */
class MyService { ... }

Just by adding "ocramius/proxy-manager" as dependency and handling Service "lazy" property you can make it. I hope you find this pull request useful

Cheers

@alber999
Copy link
Copy Markdown
Author

This test will always fail:
https://travis-ci.org/schmittjoh/JMSDiExtraBundle/jobs/93056101

traits added in PHP 5.4 but tests run on PHP 5.3.29

All other tests pass ok (except allowed failures)

@alber999
Copy link
Copy Markdown
Author

This works perfectly in full-stack symfony framework, but in a standalone application one more dependency should be added: "symfony/proxy-manager-bridge"

@TomasVotruba
Copy link
Copy Markdown

@alber999 Nice work!

As for tests, you can mark trait tests skipped for PHP 5.3-

@wodka
Copy link
Copy Markdown
Contributor

wodka commented Feb 15, 2016

@alber999 can you rebase your branch? this was fixed in the TraitTest

@alber999
Copy link
Copy Markdown
Author

@wodka done!

$this->scope,
$this->public,
$this->abstract,
$this->lazy,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It should be the last one to avoid BC breaks.

@GuilhemN
Copy link
Copy Markdown
Collaborator

Well I think I'll merge #145 instead.
So I close this PR in favor of #145.

@GuilhemN GuilhemN closed this Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants