Open olger01 opened 6 years ago
DI Containers like Symfony, Pimple and Auryn have clearly already caught up with this. As Zend Expressive 3 is so new I expect it to use the PSR-11 interface for the best compatibility with up to date DI Containers.
zend-servicemanager uses PSR-11 as well. However the AbstractPluginManager is still not compatible with psr-11 containers. If I am not misstaken, it says that zend-view requires zend-servicemanager. Until it is compatible, the solution is to use zend-servicemanager as the main container instead of symfony di or use twig or plates as the template renderer.
This repository has been closed and moved to mezzio/mezzio; a new issue has been opened at https://github.com/mezzio/mezzio/issues/9.
I set up a fresh installation of Zend Expressive 3 through the composer create-project command, and selected the following options:
Without adjusting anything within the project and accessing the project in my local development environment I'm faced with the following error:
Fatal error: Uncaught Zend\ServiceManager\Exception\InvalidArgumentException: Zend\ServiceManager\AbstractPluginManager expects a ConfigInterface or ContainerInterface instance as the first argument; received Symfony\Component\DependencyInjection\ContainerBuilder in /var/www/zend-expressive-skeleton/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php:59 Stack trace: #0 /var/www/zend-expressive-skeleton/vendor/zendframework/zend-view/src/HelperPluginManager.php(253): Zend\ServiceManager\AbstractPluginManager->__construct(Object(Symfony\Component\DependencyInjection\ContainerBuilder), Array) #1 /var/www/zend-expressive-skeleton/vendor/zendframework/zend-expressive-zendviewrenderer/src/HelperPluginManagerFactory.php(20): Zend\View\HelperPluginManager->__construct(Object(Symfony\Component\DependencyInjection\ContainerBuilder)) #2 /var/www/zend-expressive-skeleton/vendor/jsoumelidis/zend-sf-di-config/src/CallbackFactory.php(94): Zend\Expressive\ZendView\HelperPluginManagerFactory->__invoke(Object(Symfony\Com in /var/www/zend-expressive-skeleton/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 59
The problem seems to be that the application can not be instantiated as AbstractPluginManager (by extension by the HelperPluginManager) expects an instance of Interop\Container while Symfony\Component\DependencyInjection\ContainerBuilder does not implement this, but rather implements the Psr\Container\ContainerInterface directly.
This same problem also happens with both Pimple and Auryn, also selectable DI Containers. When I set up the project with the same modules, but select the default Zend DI Container it works just fine out of the box. I expected to see the same result when choosing the Symfony DI Container, Pimple, or Auryn in the configuration options, as the create project wizard leads me to believe these are supported DI Containers.
Some additional information, according to composer.lock:
As a side note: I do not fully understand why the AbstractPluginManager expects an instance of Interop\Container since this is an interface which has been deprecated over a year ago in favour of the PSR-11 Container interface. DI Containers like Symfony, Pimple and Auryn have clearly already caught up with this. As Zend Expressive 3 is so new I expect it to use the PSR-11 interface for the best compatibility with up to date DI Containers.