Git Product home page Git Product logo

Comments (10)

elie29 avatar elie29 commented on May 24, 2024 1

@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.

holtkamp avatar holtkamp commented on May 24, 2024 1

@elie29 works perfectly! Very elegant approach, compliments 👍

from zend-di-config.

elie29 avatar elie29 commented on May 24, 2024

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:

image

from zend-di-config.

holtkamp avatar holtkamp commented on May 24, 2024

@elie29 thanks for the swift response. Will try again coming week and report back here. Probably I did something wrong 😉

from zend-di-config.

holtkamp avatar holtkamp commented on May 24, 2024

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 of Psr\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

Not sure whether a solution exists other then "waiting" zend-servicemanager v4...

from zend-di-config.

thomasvargiu avatar thomasvargiu commented on May 24, 2024

You need to decorate your PSR container for Interop container compatibility, see this comment

from zend-di-config.

elie29 avatar elie29 commented on May 24, 2024

No need for a decorator. Aliasing with Psr container is enough

from zend-di-config.

elie29 avatar elie29 commented on May 24, 2024

Until zend service manager release version 4, we have to wrap DI\Container by implementing Interop\Container\ContainerInterface

from zend-di-config.

elie29 avatar elie29 commented on May 24, 2024

@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.

elie29 avatar elie29 commented on May 24, 2024

@holtkamp thank you for testing the version. We can promote it now!

from zend-di-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.