Comments (10)
@holtkamp thank you for the report.
I don't really use zend_view. However, zend-view involves zend-service-manager whose uses obsoleted interop-container.
Second, zend service acts as a container so I don't see the interest of using many containers in the same project.
I will close this issue as it is not related to this package we should wait zend service upgrade.
from zend-di-config.
@elie29 works perfectly! Very elegant approach, compliments 👍
from zend-di-config.
Thank you for your feedback.
I am using PHP-DI with zend framework and zend expressive with no issues. However, you may need container-interop as suggested by zend expressive if you want to use lazy or Abstract Factory.
I tried now the installation with composer serve and everything works correctly:
from zend-di-config.
@elie29 thanks for the swift response. Will try again coming week and report back here. Probably I did something wrong 😉
from zend-di-config.
It seems related to my preference to use zend-view
as template engine:
Which template engine do you want to use?
[1] Plates
[2] Twig
[3] zend-view installs zend-servicemanager
[n] None of the above
This involves zend-servicemanager
, which uses Interop\Container\ContainerInterface
in Zend\ServiceManager\AbstractPluginManager::__construct()
, at https://github.com/zendframework/zend-servicemanager/blob/release-2.7.11/src/AbstractPluginManager.php#L12
While the PHP-DI container implements Psr\Container\ContainerInterface
, see https://github.com/PHP-DI/PHP-DI/blob/6.0.5/src/Container.php#L29
Workarounds:
- When using Twig as template engine everything works directly, since this does not involve the Zend ServiceManager
- When using Zend View as template engine, we should change DI\Container to implement
Interop\Container\ContainerInterface
instead ofPsr\Container\ContainerInterface
- this is not a very elegant option, since the preferred approach would be to use
Psr\Container\ContainerInterface
. This seems to be a "known" issue, see: zendframework/zend-servicemanager#184
- this is not a very elegant option, since the preferred approach would be to use
Not sure whether a solution exists other then "waiting" zend-servicemanager
v4
...
from zend-di-config.
You need to decorate your PSR container for Interop container compatibility, see this comment
from zend-di-config.
No need for a decorator. Aliasing with Psr container is enough
from zend-di-config.
Until zend service manager release version 4, we have to wrap DI\Container by implementing Interop\Container\ContainerInterface
from zend-di-config.
@holtkamp I released a new version with the wrapper would you please test https://github.com/elie29/zend-di-config/releases/tag/v3.0.9
from zend-di-config.
@holtkamp thank you for testing the version. We can promote it now!
from zend-di-config.
Related Issues (20)
- Allow to declare custom definitions HOT 9
- Consider to change namespace HOT 8
- Zend\Di namespace HOT 4
- Update contributing.md document
- Add 7.3 support to travis
- Allow to disable use autowire
- Launch composer update HOT 1
- Circular dependency detected HOT 3
- Update composer HOT 2
- Make overridden delegator idempotent
- Delete container-interop/container-interop HOT 2
- migrate to laminas framework
- scalar constructor / property injection etc. HOT 1
- Compile with Delegators HOT 3
- migration to php 8 HOT 2
- Psalm (static analysis tool) integration instead of phpstan
- Support writing proxy classes to files HOT 5
- Container compilation and delegators HOT 3
- PHP8.1 Compatibility HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zend-di-config.