-
Notifications
You must be signed in to change notification settings - Fork 25
[WIP] fix 'alias already exists errors' #74
Conversation
@@ -56,6 +57,9 @@ class Generator implements Constants | |||
// Override the following to use an alternate "not found" delegate. | |||
NotFoundDelegate::class => NotFoundDelegateFactory::class, |
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.
this still causes An alias by the name "zendexpressivedelegatenotfounddelegate" or "Zend\Expressive\Delegate\NotFoundDelegate" already exists
but don't know if I can remove it or have to change to something else @weierophinney can you help?
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.
Where/when do you get that error message, exactly?
I'm reviewing the slack conversation where you detail these problems, and I'm having trouble understanding how they could happen in the first place. Configuration such as this is aggregated during bootstrapping before seeding the container itself. If you're getting such messages, it's usually an indication that you're manually building your container.
Can you provide a bit more context, please?
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.
I found it when helping to fix this Naktibalda/codeception-zend-expressive-tests#7 I was able to fix it by requiring servicemanager v3 but expressive should work with any PSR-7 container implementation and when SM2 I get those errors
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.
Okay, then this may be a moot issue.
Expressive v2 releases do not support zend-servicemanager v2. They pin to v3 releases (see here and here. While Expressive v1 releases supported zend-servicemanager v2, we dropped support for those versions specifically because of discrepancies in how they operate in relation to v3.
If the error only occurs when using zend-servicemanager v2, then we can close this issue; we do not support that version in releases where this tooling would be relevant.
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.
yes the error only exists with SM v2 but I do not understand if zend-expressive supports any PSR-11 implementation and SeriviceManager v2 is PSR-11 implementation then why it does not work? maybe other also will not work?
I don't fully understand the situation here, but if you think this not an issue feel free to close this as I already using expressive3
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.
It's not a matter of whether or not both are PSR-11 compatible; for that purpose, the has()
and get()
methods of each operate identically.
The issue is that zend-servicemanager v2 and v3 have a few differences in how they handle container population, with v3 fixing issues in v2 that we could not address without a BC break. One of these is how it identifies service conflicts during initial configuration. v3 has a better algorithm — but it's one we cannot backport, as it introduces BC breaks elsewhere. For this reason, we chose to only support zend-servicemanager v3 in Expressive v2 and up.
@@ -56,6 +57,9 @@ class Generator implements Constants | |||
// Override the following to use an alternate "not found" delegate. | |||
NotFoundDelegate::class => NotFoundDelegateFactory::class, |
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.
Where/when do you get that error message, exactly?
I'm reviewing the slack conversation where you detail these problems, and I'm having trouble understanding how they could happen in the first place. Configuration such as this is aggregated during bootstrapping before seeding the container itself. If you're getting such messages, it's usually an indication that you're manually building your container.
Can you provide a bit more context, please?
@@ -33,6 +33,7 @@ class Generator implements Constants | |||
use Zend\Expressive\Middleware\ImplicitHeadMiddleware; | |||
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware; |
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.
Change these to reference the zend-expressive-router variants, and also import their factories; the changes starting at line 60 then need updating.
@@ -12,6 +12,7 @@ | |||
use Zend\Expressive\Middleware\ImplicitHeadMiddleware; | |||
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware; |
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.
Remove the above two lines.
@@ -23,7 +23,7 @@ | |||
"symfony/console": "^2.8 || ^3.0 || ^4.0", | |||
"zendframework/zend-code": "^3.1 || ^2.6.3", | |||
"zendframework/zend-component-installer": "^1.0 || ^0.7.1", | |||
"zendframework/zend-expressive": "^2.0", | |||
"zendframework/zend-expressive": "^2.2", |
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.
@weierophinney should I update composer.lock
?
Closing. As noted in comments above, it turns out that this issue only arises when using zend-servicemanager v2 — which Expressive versions 2 and above no longer support due to differences in how the v2 vs v3 containers populate themselves from configuration. |
does not need those options becouse already defined here https://github.com/zendframework/zend-expressive/blob/2.2.1/src/ConfigProvider.php#L39-L42 and throws those exceptions
this should be rebased and merged only to 0.4 version