This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
New LazyControllerFactory #165
Merged
weierophinney
merged 9 commits into
zendframework:master
from
weierophinney:feature/lazy-service-controller-factory
Jun 23, 2016
Merged
New LazyControllerFactory #165
weierophinney
merged 9 commits into
zendframework:master
from
weierophinney:feature/lazy-service-controller-factory
Jun 23, 2016
Commits on Jun 23, 2016
-
Inspired by http://circlical.com/blog/2016/3/9/preparing-for-zend-f, this abstract factory/factory can be used to create controller instances for controllers defining constructor dependencies, using the following rules: - A parameter named `$config` typehinted as an array will receive the application "config" service (i.e., the merged configuration). - Parameters type-hinted against array, but not named `$config` will be injected with an empty array. - Scalar parameters will be resolved as null values. - If a service cannot be found for a given typehint, the factory will raise an exception detailing this. - Some services provided by Zend Framework components do not have entries based on their class name (for historical reasons); the factory contains a map of these class/interface names to the corresponding service name to allow them to resolve. `$options` passed to the factory are ignored in all cases, as we cannot make assumptions about which argument(s) they might replace. As it implements zend-servicemanager's v3 AbstractFactoryInterface, it may be used as either an abstract factory, or by mapping controller class names to the factory.
Configuration menu - View commit details
-
Copy full SHA for 8e2e226 - Browse repository at this point
Copy the full SHA 8e2e226View commit details -
Configuration menu - View commit details
-
Copy full SHA for df3000d - Browse repository at this point
Copy the full SHA df3000dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ba6e25 - Browse repository at this point
Copy the full SHA 4ba6e25View commit details -
Configuration menu - View commit details
-
Copy full SHA for 33c8cc9 - Browse repository at this point
Copy the full SHA 33c8cc9View commit details -
Remove test for non-string $requestedName
cannot happen with version 3 servicemanager.
Configuration menu - View commit details
-
Copy full SHA for e4a813c - Browse repository at this point
Copy the full SHA e4a813cView commit details -
Made $aliases protected (not private)
- Allows extending in order to add more aliases.
Configuration menu - View commit details
-
Copy full SHA for dd34bad - Browse repository at this point
Copy the full SHA dd34badView commit details -
- Updated instantiation to use splat operator instead of reflection - switch from array_key_exists to isset Both per @snapshotpl
Configuration menu - View commit details
-
Copy full SHA for bc75c3d - Browse repository at this point
Copy the full SHA bc75c3dView commit details -
Extracted parameter resolution to a new method, and modified factory to use array_map with that method to create the list of parameters for instantiating the controller.
Configuration menu - View commit details
-
Copy full SHA for 7d30314 - Browse repository at this point
Copy the full SHA 7d30314View commit details -
`resolveParameter()` now accepts the container and requested name, and returns a callback for resolving a parameter to a value, closing over the two provided values. This simplifies the array_map call, making it more readable.
Configuration menu - View commit details
-
Copy full SHA for 00ba958 - Browse repository at this point
Copy the full SHA 00ba958View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.