This repository was archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
SM Refactor #2
Closed
Closed
SM Refactor #2
Changes from all commits
Commits
Show all changes
807 commits
Select commit
Hold shift + click to select a range
b81bb0b
Merge pull request zendframework/zf2#5155
Maks3w 5cb1126
Merge pull request zendframework/zf2#5155 in develop
Maks3w b1adcfd
Merge pull request zendframework/zf2#5155 in master
Maks3w 7443d6c
Removed all @category, @package, and @subpackage annotations …
Maks3w 2190833
Merge zendframework/zf2#5215 into develop
Maks3w fa773c1
Merge pull request zendframework/zf2#5215 from Maks3w/remove-depracte…
Maks3w 2db45bb
Merge branch 'master', remote-tracking branch 'upstream/master'
EpeeCheeze a70e111
Merge branch 'develop' of github.com:zendframework/zf2 into develop
manchuck 747fe27
make sure abstract factories, factories and services all handle types…
bb1261e
add new method for delegators
6dbeb69
revert test edits and add new tests
cc45e00
fix BC
c9b63e8
add single delegator tests for abtract plugin manager
ca07912
add multiple delegator test for abtract plugin manager
9df16c2
test cleanup
942f443
add delegator factory validation testing
35f9f65
add delegator from callback test
b95e474
fix callback test
b580d44
add callback support for delegator factories
d22ed52
code cleaning
189cb73
Merge remote-tracking branch 'zf2/develop' into zend-validator-bitwise
dc2205d
Merge pull request zendframework/zf2#5100 from tux-rampage/sm-cyclic-…
weierophinney b655053
[zendframework/zf2#5100] CS fixes
weierophinney e7edbc6
Merge branch 'hotfix/5100'
weierophinney 88622d8
Merge branch 'hotfix/5100' into develop
weierophinney eb8c896
fix trolling abstract factories
turrsis e27390d
Merge pull request zendframework/zf2#5175 from stefanotorresi/fix/pm-…
weierophinney 9650994
Merge branch 'hotfix/5175'
weierophinney f8d5651
Merge branch 'hotfix/5175' into develop
weierophinney 63fdc18
Merge pull request zendframework/zf2#5237 from turrsis/hotfix/service…
weierophinney 6ba4a64
[zendframework/zf2#5237] Consistency fix
weierophinney 74a2c5d
Merge branch 'feature/5237' into develop
weierophinney c808f6b
Merge pull request zendframework/zf2#5293 from stefanotorresi/hotfix/…
weierophinney 000d868
[zendframework/zf2#5293] review
weierophinney fc2f0a0
Merge branch 'hotfix/5293'
weierophinney a4bdb9a
Merge branch 'hotfix/5293' into develop
weierophinney b7e6df5
CS fixes
turrsis c5feb13
Merge pull request zendframework/zf2#5333
Maks3w cb22cac
Merge pull request zendframework/zf2#5333 in develop
Maks3w 5700ed4
Merge pull request zendframework/zf2#5333 in master
Maks3w 4ad8580
add test to replicate zendframework/zf2#4285
c35c23c
use mock instead of concrete object
140c7df
Merge branch
e71908f
fix for issue zendframework/zf2#5395. I know its going to be deprecat…
34b0a00
fix squash
e61cf17
Issue zendframework/zf2#5395: remove unnecessary can create function …
franz-deleon 0d2078e
Merge branch 'fix' into develop
franz-deleon e28ccc5
reverting back canCreate for backwards compatibility
franz-deleon 96aab3d
Merge pull request zendframework/zf2#5390 from stefanotorresi/test/ab…
weierophinney c4c2224
Merge branch 'feature/5390' into develop
weierophinney be837f8
Merge pull request zendframework/zf2#5396 from franz-deleon/develop
weierophinney 9545e2d
[zendframework/zf2#5396] CS fixes
weierophinney e60ed4a
Merge branch 'feature/5396' into develop
weierophinney 5965ec2
Merge branch 'master' into ValidatorMessages
ce36da0
Fix typehint for getServiceLocator().
Thinkscape b78dcf5
Merge pull request zendframework/zf2#5471 from Thinkscape/patch-1
weierophinney 70a7885
Merge branch 'hotfix/5471'
weierophinney 157a03a
Merge branch 'hotfix/5471' into develop
weierophinney de862d0
remove unused uses
samsonasik 06100ad
Merge pull request zendframework/zf2#5472
Maks3w a2237d5
Merge pull request zendframework/zf2#5472 in develop
Maks3w a464957
Merge pull request zendframework/zf2#5472 in master
Maks3w 64ddc63
Merge branch 'master' of https://github.com/zendframework/zf2 into zf…
22e3b69
copyright update for 2014 - tests
BinaryKitten 0c71e7b
copyright update for 2014 - Zend Library
BinaryKitten 5cfcc45
Merging PR zendframework/zf2#5654
39f70f1
Back-port of copyright changes to master
2702520
[cs] Remove unnecessary use statements
Maks3w df1ad0c
Merge remote-tracking branch 'upstream/develop' into develop
brian978 8db253f
Merge pull request zendframework/zf2#5672 branch 'hotfix/cs-cleanup'
Maks3w 30d2b4b
Forward port zendframework/zf2#5672
Maks3w 64ca352
Get an abstract defined service from an alias
jmleroux 384c90e
consistent naming
jmleroux ab9888d
added test for Zend\ServiceManager\ServiceManager::get : testGetAbs…
jmleroux 2863fa2
Updated ServiceManager tests, added failing tests for the missing for…
bacinsky ca4e8c5
Fix for zendframework/zf2#5795 - updated ServiceManager, added break …
bacinsky 0b44f4d
Merge remote-tracking branch 'upstream/master'
poisa e450dc0
Merge pull request zendframework/zf2#5755
Maks3w 9ed9a14
Merge pull request zendframework/zf2#5755 in develop
Maks3w bdd4b7d
Merge pull request zendframework/zf2#5755 in master
Maks3w 8486de0
Merge branch 'develop' of github.com:zendframework/zf2 into fieldset-…
veewee baec943
Removing deprecated call to `ProxyManager\Configuration#setAutoGenera…
Ocramius e34c1b8
Uniform functionality of `write_proxy_files` and `auto_generate_proxi…
Ocramius 00af3be
Moving up code setting the proxy namespace (used internally in the co…
Ocramius 461a1c9
Importing test from zendframework/zf2zendframework/zf2#5198 by @blanc…
Ocramius 999071e
Always enable proxy autoloader
Ocramius bcd9c75
Removing duplicate test case
Ocramius 97c0b30
Completely dropping `auto_generate_proxies` flag (deprecated)
Ocramius 830ef3d
Removing `auto_generate_proxies` flag from tests
Ocramius 1a30196
Merge pull request zendframework/zf2#5858 from Ocramius/hotfix/proxy-…
Maks3w 1ce24fa
Merge branch 'develop' of github.com:zendframework/zf2 into fieldset-…
veewee 8ca9b61
Merge pull request zendframework/zf2#5795 from bacinsky/fix/service-m…
weierophinney d7617c8
Merge branch 'hotfix/5795' into develop
weierophinney 13d474d
Merge pull request zendframework/zf2#5752 from jmleroux/patch-2
weierophinney b352d58
[zendframework/zf2#5752] CS fixes
weierophinney f848448
Merge branch 'hotfix/5752'
weierophinney fa1a9da
Merge branch 'hotfix/5752' into develop
weierophinney 74575c7
Merge pull request zendframework/zf2#1 from zendframework/master
leogr 2506cd9
[2.3.0] change php require version from 5.3.3 to 5.3.23 in all resour…
samsonasik fce725c
Merge pull request zendframework/zf2#5604 from samsonasik/change/php-…
Maks3w 9ade022
Merge conflicts
veewee 5f907a0
Merge branch 'develop' of github.com:zendframework/zf2 into fieldset-…
veewee f89400a
Merge branch 'develop'
weierophinney a883bbe
Upgrading branch aliases for components: 2.2-dev -> 2.3-dev, 2.3-dev …
Ocramius 2d8fce3
Merge pull request zendframework/zf2#5964
Maks3w 047971c
Merge pull request zendframework/zf2#5964 in develop
Maks3w 840ac1e
Merge pull request zendframework/zf2#5964 in master
Maks3w 97532bf
Missed variable, renamed to one which exists.
spalax e9d1799
Adding `@group` annotation for tests introduced in zendframework/zf2#…
Ocramius 25d94d4
Merge branch 'hotfix/zendframework/zf2#6021-di-abstract-factory-inval…
Ocramius 7a063bd
Merge branch 'hotfix/zendframework/zf2#6021-di-abstract-factory-inval…
Ocramius 35badf8
Fix zendframework/zf2#5959 update DiAbstractFactory canCreateServiceW…
noopable 009685d
tmp: Revert "Fix zendframework/zf2#5959 update DiAbstractFactory canC…
noopable d56de0e
Fix zendframework/zf2#5959 update DiAbstractFactory canCreateServiceW…
noopable 698e4c9
Merge branch 'hotfix/zendframework/zf2#5959-zendframework/zf2#6022-ze…
Ocramius bf87264
Merge branch 'hotfix/zendframework/zf2#5959-zendframework/zf2#6022-ze…
Ocramius b7f96b6
Fix: No need to prefix imports
localheinz e68310c
Merge branch 'cs/zendframework/zf2#5029-imports-fqcn-not-prefixed-wit…
Ocramius 078e9a3
Merge branch 'cs/zendframework/zf2#5029-imports-fqcn-not-prefixed-wit…
Ocramius 22702d4
Fixes zendframework/zf2#6187
samsonasik 2ed48d5
Merge branch 'feature/zendframework/zf2#6187-homepage-link-for-compon…
Ocramius e8f0df0
Merge branch 'feature/zendframework/zf2#6187-homepage-link-for-compon…
Ocramius cf6d9d7
* added MutableCreationOptionsAwareTrait
demichl68 9ad59ae
Update MutableCreationOptionsAwareTrait.php
demichl68 7ab299d
Create MutableCreationOptionsAwareTraitTest.php
demichl68 53cad74
Update MutableCreationOptionsAwareTraitTest.php
demichl68 d48b8fb
Update MutableCreationOptionsAwareTraitTest.php
demichl68 1b55acb
Update MutableCreationOptionsAwareTrait.php
demichl68 81205fe
* fixed array notation
demichl68 c51dd79
* improved options array readability
demichl68 0e67353
* fixed @requires annotation
demichl68 bc329cf
* explicitly skipping unit tests on PHP Version < 5.4 as "@require" …
demichl68 2f49978
* removed "Aware" from Classname
demichl68 002342b
Merge branch 'feature/mutable-creation-options-traits' into develop
Ocramius 5c7faf9
I18n - Allow custom translation loaders to be injected via module co…
rodmcnew 795eee4
Merge branch 'master' of github.com:zendframework/zf2
davidwindell 6bad72d
Merge branch 'master' of https://github.com/zendframework/zf2
0c02be7
updated date validator to support large integers
svycka 9c50ec8
Add failing test for encoded routes with a query
008d34b
Support subscribing to folders in IMAP
ameir 599b863
fixed removing handled header parts from response header
kasitmp 2356545
Created helper used for rendering <html> tag of a web page, to which …
nikolaposa ad73ec9
Added form annotation builder factory
carnage f1159ae
fix for FilesSize validator usage with Input
bgotink 5976b51
Cache result of processing and inline the check
nickpeirson 63691f1
Cache classes upfront where possible to reduce iterations
nickpeirson ced2213
Added ability to specify label position as an element label option
carnage 9b87f39
Added continueIfEmpty annotation to Zend Form
carnage 1b54c83
Test cases for nextPredicateCombineOrder + addPredicate()
4f01722
Fix inability to translate to languages which don't have plural forms
hissy 873b36f
Soap Connection Timeout
jameswithers 1b0cc8f
Merge branch 'master' of https://github.com/zendframework/zf2 into ad…
postalservice14 049bbb7
CS Fix
Slamdunk 1aa18bd
Merge branch 'cs/zendframework/zf2#6872-php-cs-fixer-automated-fixes'
Ocramius 9206ab2
Merge branch 'cs/zendframework/zf2#6872-php-cs-fixer-automated-fixes'
Ocramius 6543d96
Added a failing test case for zendframework/zf2#4208
awartoft cb19a06
Resolved the failing issue for zendframework/zf2#4208
awartoft 1984c66
Reverted the php array notation changes.
awartoft b474197
Merge branch 'hotfix/zendframework/zf2#6902-plugin-manager-auto-invok…
Ocramius 31ba998
Merge branch 'hotfix/zendframework/zf2#6902-plugin-manager-auto-invok…
Ocramius 3f42847
Failing test for zendframework/zf2#4377
adamlundrigan 77048ac
When pulling from a peered SM, pull shared flag of service from peer …
adamlundrigan 940a09d
Simplify + correct placement of service existence check in ServiceMan…
adamlundrigan 1254fac
CS fix
adamlundrigan 9438dd7
Merge branch 'hotfix/zendframework/zf2#6548-peering-service-manager-s…
Ocramius 0c75550
Merge branch 'hotfix/zendframework/zf2#6548-peering-service-manager-s…
Ocramius 3d93700
Added consts for left and right outer/inner joins
b9866e1
remove PHP_VERSION_ID check before 50323
samsonasik bf226e8
fixes cs for unused use ReflectionClass
samsonasik f0a95cf
return is_subclass_of directly
samsonasik 12492f0
zendframework/zf2#6785 - using `is_subclass_of()` instead of protecte…
Ocramius 6a142a2
Merge branch 'hotfix/zendframework/zf2#6785-remove-version-checks-for…
Ocramius d8ff77e
Merge branch 'hotfix/zendframework/zf2#6785-remove-version-checks-for…
Ocramius 2e749b7
Add fail test case
blanchonvincent 8825b9d
Add a second fail test case
blanchonvincent 277c361
Provide fix
blanchonvincent 9e2e9dd
Fix CS
blanchonvincent 01f8886
zendframework/zf2#6833 - adding IDE hints in test case for clarity
Ocramius 771cc07
zendframework/zf2#6833 - simplified tests, should throw also on inval…
Ocramius b6dd8c6
zendframework/zf2#6833 - aligning `AbstractPluginManager` to latest i…
Ocramius b7deb09
zendframework/zf2#6833 - s/Exception/BaseException
Ocramius aa91f9b
zendframework/zf2#6833 - specification for `ServiceLocatorUsageExcept…
Ocramius 4ea1da4
zendframework/zf2#6833 - coverage annotations
Ocramius 4f89291
zendframework/zf2#6833 - implemented `ServiceLocatorUsageException` a…
Ocramius a5787cf
zendframework/zf2#6833 - re-using `ServiceLocatorUsageException::from…
Ocramius a236154
zendframework/zf2#6833 - adding `@throws` annotations to `AbstractPlu…
Ocramius 893b854
zendframework/zf2#6833 - `AbstractPluginManager` should reset invokab…
Ocramius b52df72
zendframework/zf2#6833 - `AbstractPluginManager` should reset invokab…
Ocramius 16c1dcb
zendframework/zf2#6833 - adding missing `@group` annotations to newly…
Ocramius 8019885
zendframework/zf2#6833 - minor CS fixes (spacing/braces)
Ocramius 49cb146
zendframework/zf2#6833 - minor CS fixes (EOF EOL)
Ocramius aadb681
zendframework/zf2#6833 - minor CS fixes (removed unused imports)
Ocramius eb969ce
Merge branch 'feature/zendframework/zf2#6833-abstract-plugin-manager-…
Ocramius 2bccbe6
added ocramius/proxy-manager into Zend\ServiceManager's composer.json
samsonasik 9137eae
Merge branch 'deps/zendframework/zf2#6751-zend-servicemanager-suggest…
Ocramius c0cf550
Merge branch 'deps/zendframework/zf2#6751-zend-servicemanager-suggest…
Ocramius 0f1b888
PHPCS fixes for Zend\ServiceManager
chadicus fc40746
Merge branch 'cs/zendframework/zf2#6995-zend-servicemanager-psr2-comp…
Ocramius aeb4704
Merge branch 'cs/zendframework/zf2#6995-zend-servicemanager-psr2-comp…
Ocramius cc18b43
CS: `return` instead of `return null`
keradus 0380d0b
Merge branch 'cs/zendframework/zf2#7014-empty-return-instead-of-null-…
Ocramius d6e223b
CS: Removes line breaks between use statements.
keradus dead2e2
Merge branch 'cs/zendframework/zf2#7025-no-breaks-between-imported-cl…
Ocramius 3e28d57
tests - apply parenthesis fixer
keradus 7b787f7
Merge branch 'cs/zendframework/zf2#7027-no-space-after-open-or-close-…
Ocramius ee3e323
library - apply whitespacy_lines fixer
keradus 805b560
Merge pull request zendframework/zf2#7049 from keradus/whitespacy_lines
Ocramius 752e9a2
tests - apply lowercase_keywords
keradus 9ef93b6
Merge branch 'master' into dev-filefilessize
bgotink 9350547
Merge pull request zendframework/zf2#7053 from keradus/lowercase_keyw…
Ocramius 89cbe69
Happy new year 2015
samsonasik c1af016
Merge branch 'license/zendframework/zf2#7087-license-headers-year-bump'
Ocramius 8e08eff
Merge branch 'license/zendframework/zf2#7087-license-headers-year-bum…
Ocramius a5d9cef
zendframework/zf2#7087 - updating `develop` newly introduced files to…
Ocramius 181295d
Updated german translation file
FranzBruckner f603011
Oracle quoting fix for values with single quotes
marcelto 60f6978
A failing test to show that FormButtonHelper does not translate $butt…
Victory de612ba
Detect https on reversed proxy
c225829
Merge pull request zendframework/zf2#6747 from nickpeirson/DI-Definit…
weierophinney e173fb3
Merge branch 'feature/6747' into develop
weierophinney ca2a8ad
Fix infinite loop when chaining peering service managers
fabiang d06f5e8
Merge pull request zendframework/zf2#7296 from fabiang/infinite-loop-…
weierophinney 13cecc8
Incorporated feedback for zendframework/zf2#7296
weierophinney 0768225
Merge branch 'feature/7296' into develop
weierophinney 3979e15
Merge pull request zendframework/zf2#1 from zendframework/develop
kokspflanze e69a32a
Fixed CS issues reported by php-cs-fixer
weierophinney 98b335b
Merge branch 'hotfix/code-trait-5.3' into develop
weierophinney 7a49640
Merge branch 'develop'
weierophinney ed0ad9d
update composer's branch-alias
samsonasik b9933f1
[test] Replace assertTrue(is_FOO) with assertInternalType('FOO')
Maks3w 8bf1ab6
CS fixes as reported by php-cs-fixer
weierophinney bb5c890
Merge branch 'hotfix/7477'
weierophinney 04224aa
Merge pull request zendframework/zf2#7476 from Maks3w/hotix/remove-ev…
weierophinney 9dd8ff7
Merge branch 'hotfix/7476'
weierophinney 8e46cd8
Merge pull request zendframework/zf2#7391 from samsonasik/hotfix/comp…
weierophinney 9d9b06e
Merge branch 'hotfix/7391'
weierophinney 01ae562
Initial refactor
bakura10 27fab44
Rename parameter interface
bakura10 a0b49ff
update phpunit version
samsonasik 7767169
update bootstrap's test for phpunit version_compare check
samsonasik ba50d82
update factory description
samsonasik 71b4a70
Merge pull request #1 from samsonasik/patch-1
bakura10 c90d9fb
Merge pull request #2 from samsonasik/patch-2
bakura10 de2acd7
Merge pull request #3 from samsonasik/patch-3
bakura10 a8275e6
Update LazyServiceFactoryFactoryTest.php
manuakasam 162e1f0
Merge pull request #4 from manuakasam/patch-1
bakura10 dae7b59
Add changelog
bakura10 dd8d5b6
Add more changelog
bakura10 44dbee6
Add Interop container
bakura10 adaaa34
Add exception
bakura10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
# CHANGELOG | ||
|
||
## v3.O.0 | ||
|
||
### Changed | ||
|
||
v3 of the ServiceManager component is a completely rewritten, more efficient implementation of the service locator | ||
pattern. It includes a number of breaking changes, that are outlined in this section. | ||
|
||
- Peering has been removed. It was a complex and rarely used feature that was misunderstood most of the time. | ||
|
||
- Integration with `Zend\Di` has been removed. It may be re-integrated later as part of another component. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be re-added via an abstract factory fairly easily, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so but as I've never really used Di I prefer not to pronounce :) |
||
|
||
- You no longer need a `Zend\ServiceManager\Config` object to configure the service manager, but you instead need to | ||
simply pass an array. | ||
|
||
In ZF 2.x: | ||
|
||
```php | ||
$config = new \Zend\ServiceManager\Config([ | ||
'factories' => [...] | ||
]); | ||
|
||
$sm = new \Zend\ServiceManager\ServiceManager($config); | ||
``` | ||
|
||
In ZF 3.x: | ||
|
||
```php | ||
$sm = new \Zend\ServiceManager\ServiceManager([ | ||
'factories' => [...] | ||
]); | ||
``` | ||
|
||
- Service manager is now immutable. Once configured, it cannot be altered. You need to create a new service manager | ||
if you need to change the configuration. This allow to ensure safer and more aggressive caching. | ||
|
||
- `invokables` key no longer exists. It has been replaced by a built-in factory. | ||
|
||
In ZF 2.x: | ||
|
||
```php | ||
return [ | ||
'service_manager' => [ | ||
'invokables' => [ | ||
MyClass::class => MyClass:class | ||
] | ||
] | ||
]; | ||
``` | ||
|
||
In ZF 3.x: | ||
|
||
```php | ||
return [ | ||
'service_manager' => [ | ||
'factories' => [ | ||
MyClass::class => \Zend\ServiceManager\Factory\InvokableFactory:class | ||
] | ||
] | ||
]; | ||
``` | ||
|
||
- Interfaces for `FactoryInterface`, `DelegatorFactoryInterface` and `AbstractFactoryInterface` have changed. Now, | ||
they are all callable. This allow to optimize performance. Most of the time, rewriting a factory to match new interface | ||
implies replacing the method name by `__invoke`. | ||
|
||
For instance, here is a simple ZF 2.x factory: | ||
|
||
```php | ||
class MyFactory implements FactoryInterface | ||
{ | ||
function createService(ServiceLocatorInterface $sl) | ||
{ | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
The equivalent ZF 3.x factory: | ||
|
||
```php | ||
class MyFactory implements FactoryInterface | ||
{ | ||
function __invoke(ServiceLocatorInterface $sl, $requestedName) | ||
{ | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
As you can see, factories also receive a second parameter enforce through interface, that allows to easily map multiple | ||
service names to the same factory. | ||
|
||
- Plugin managers will now receive the parent service locator instead of itself in factories. In ZF 2.x, you needed | ||
to call the method `getServiceLocator` to retrieve the main service locator. This was confusing, and was not IDE friendly | ||
as this method was not enforced through interface. | ||
|
||
In ZF 2.x, if a factory was set to a service name defined in a plugin manager: | ||
|
||
```php | ||
class MyFactory implements FactoryInterface | ||
{ | ||
function createService(ServiceLocatorInterface $sl) | ||
{ | ||
// $sl is actually a plugin manager | ||
|
||
$parentLocator = $sl->getServiceLocator(); | ||
|
||
// ... | ||
} | ||
} | ||
``` | ||
|
||
In ZF 3.x: | ||
|
||
```php | ||
class MyFactory implements FactoryInterface | ||
{ | ||
function __invoke(ServiceLocatorInterface $sl, $requestedName) | ||
{ | ||
// $sl is already the main, parent service locator. If you need to retrieve the plugin manager again, you | ||
// can retrieve it through the SL | ||
$pluginManager = $sl->get(MyPluginManager::class); | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
In practice, this should reduce code as dependencies often come from the main service locator, and not the plugin | ||
manager itself. | ||
|
||
- `PluginManager` now enforce the need for the main service locator in their constructor. In ZF2, people often forgot | ||
to set the parent locator, which leads to bugs in factories trying to fetch dependencies from the parent locator. | ||
|
||
- `MutableCreationOptionsInterface` has been removed, as options can now be passed directly through factories. (??) | ||
|
||
- `ServiceLocatorAwareInterface` and its associated trait has been removed. It was an anti-pattern, and you are encouraged | ||
to inject your dependencies in factories instead of injecting the whole service locator. | ||
|
||
- It's so fast now that your app will fly. | ||
|
||
### Added | ||
|
||
- You can now map multiple key names to the same factory. It was previously possible in ZF2 but it was not enforced | ||
by the `FactoryInterface` interface. Now, this interface receives the `$requestedName` as second parameter. | ||
|
||
Example: | ||
|
||
```php | ||
$sm = new \Zend\ServiceManager\ServiceManager([ | ||
'factories' => [ | ||
MyClassA::class => MyFactory::class, | ||
MyClassB::class => MyFactory::class | ||
] | ||
]); | ||
|
||
$sm->get(MyClassA::class); // MyFactory will receive MyClassA::class as second parameter | ||
``` | ||
|
||
- Writing a plugin manager has been simplified. If you have simple needs, you no longer need to implement the complete | ||
`validate` method. | ||
|
||
In ZF 2.x, if your plugin manager only accepts to create instances that implement `Zend\Validator\ValidatorInterface`, | ||
you needed to write this code: | ||
|
||
```php | ||
class MyPluginManager extends AbstractPluginManager | ||
{ | ||
public function validate($instance) | ||
{ | ||
if ($instance instanceof \Zend\Validator\ValidatorInterface) { | ||
return; | ||
} | ||
|
||
throw new InvalidServiceException(sprintf( | ||
'Plugin manager "%s" expected an instance of type "%s", but "%s" was received', | ||
__CLASS__, | ||
\Zend\Validator\ValidatorInterface::class, | ||
is_object($instance) ? get_class($instance) : gettype($instance) | ||
)); | ||
} | ||
} | ||
``` | ||
|
||
In ZF 3.x: | ||
|
||
```php | ||
class MyPluginManager extends AbstractPluginManager | ||
{ | ||
protected $instanceOf = \Zend\Validator\ValidatorInterface::class; | ||
} | ||
``` | ||
|
||
Of course, you can still override `validate` method if your logic is more complex. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
{ | ||
"name": "zendframework/zend-service-manager", | ||
"description": "Zend\\ServiceManager component", | ||
"name": "zendframework/zend-servicemanager", | ||
"description": " ", | ||
"license": "BSD-3-Clause", | ||
"keywords": [ | ||
"zf2", | ||
"zf", | ||
"servicemanager", | ||
"service-manager" | ||
], | ||
"homepage": "https://github.com/zendframework/zend-servicemanager", | ||
"autoload": { | ||
"psr-4": { | ||
"Zend\\ServiceManager\\": "src/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.3.23" | ||
"php": ">=5.5", | ||
"container-interop/container-interop": "*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.6", | ||
"ocramius/proxy-manager": "~1.0", | ||
"fabpot/php-cs-fixer": "1.7.*", | ||
"satooshi/php-coveralls": "dev-master", | ||
"phpunit/PHPUnit": "~4.0" | ||
"satooshi/php-coveralls": "dev-master" | ||
}, | ||
"suggest": { | ||
"ocramius/proxy-manager": "ProxyManager 1.* to handle lazy initialization of services" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "3.0-dev", | ||
"dev-develop": "3.1-dev" | ||
} | ||
}, | ||
"homepage": "https://github.com/zendframework/zend-service-manager", | ||
"autoload-dev": { | ||
"psr-4": { | ||
"ZendTest\\ServiceManager\\": "test/" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for adding this; I think it will be a fantastic reference.