Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

factory sharing for pimple container #53

Merged
merged 1 commit into from
Mar 17, 2016

Conversation

pine3ree
Copy link

@pine3ree pine3ree commented Jan 6, 2016

just an idea based on zend-servicemanager v3:

  • stores the factory in the container
  • allows reuse of the same factory (and same instance) for more than one service
  • pass an extra parameter to the factory in order to make it possible to identify the requested service

Naming:
should we change $object to $factoryClass and $invokableClass to make it more explicit?

just an idea based on zf-servicemanager 3:
- stores the factory in the container
- allows reuse of the same factory (and same instance) for more than one service

Naming:
should we change $object to $factoryClass and $invokableClass to make it more explicit?
@weierophinney
Copy link
Member

There are cases where you may want discrete instances of the factory. Additionally, the number of times you'll likely re-use the same factory are small enough that this would be a micro-optimization with side-effects.

@pine3ree
Copy link
Author

@weierophinney
Hello Matthew, my goal was having different services with the same dependencies share the same factory in a similar fashion of zend-servicemanager 3. Could we add this feature for pimple container, maybe using a different $config['dependencies'] key, st like'shared_factories'?

kind regards

@weierophinney
Copy link
Member

@pine3ree Ah, I see; in zend-servicemanager, we cache the factory instance after first instantiation, and you're trying to emulate that. Re-opening, then.

@weierophinney weierophinney reopened this Jan 25, 2016
@weierophinney weierophinney added this to the 1.0.1 milestone Jan 25, 2016
@weierophinney weierophinney self-assigned this Jan 25, 2016
@weierophinney weierophinney merged commit aa115bd into zendframework:master Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
factory sharing for pimple container
weierophinney added a commit that referenced this pull request Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
@pine3ree pine3ree deleted the patch-1 branch September 1, 2016 14:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants