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

Resolve/instantiate factories using the container #308

Merged
merged 3 commits into from Sep 6, 2015

Conversation

Projects
None yet
1 participant
@mnapoli
Member

mnapoli commented Sep 2, 2015

Fix #179, start of #197

return [
    'Foo' => DI\factory(['FooFactory', 'create']),
];

With this configuration, FooFactory will be created by the container.

If FooFactory::create() is static, no instance will be created (and the method will be called statically).

Performance tests and profiling showed a performance regression of up to +40% (worst case) to resolve factories (after working on optimizations). I think this is acceptable given it's only a small part of the whole container (the total performance regression should be negligible, especially since 5.1 already brings good improvements to compensate).

TODO:

  • documentation
  • changelog

@mnapoli mnapoli added the enhancement label Sep 2, 2015

@mnapoli mnapoli added this to the 5.1 milestone Sep 2, 2015

@mnapoli mnapoli changed the title from Resolve factories from the container using the invoker to Resolve factories from the container Sep 6, 2015

@mnapoli mnapoli changed the title from Resolve factories from the container to Resolve/instantiate factories using the container Sep 6, 2015

mnapoli added a commit that referenced this pull request Sep 6, 2015

Merge pull request #308 from PHP-DI/179
Resolve/instantiate factories using the container

@mnapoli mnapoli merged commit 308c2cf into master Sep 6, 2015

0 of 3 checks passed

Scrutinizer Created
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@mnapoli mnapoli deleted the 179 branch Sep 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment