dflydev / dflydev-doctrine-orm-service-provider

Doctrine ORM Service Provider
MIT License
209 stars 59 forks source link

Pimple requirement conflicts with silex #67

Closed uuf6429 closed 8 years ago

uuf6429 commented 8 years ago

I'm not sure how this problem came up. Probably no one's been testing this on silex, or something similar.

So, basically, if you install silex (latest stable => 1.3) and then try to install this, composer will complain that pimple used by silex is v1.x whereas a v3.x is required.

Some quick research seems to point out that silex 2 (currently in dev) requires pimple v3.

What I find weird in this situation is that both this repository's readme as well as silex's 3rd party providers page say that this should work (note that there is a dedicated page for 3rd party providers for silex 2).

This might not be a bug per se, but I'd like to see some clarifications (and maybe a documentation update - maybe from my side).

simensen commented 8 years ago

@uuf6429 can you share your composer.json and the exact output you get from composer that says that there is some conflict? v2.x should work w/ silex 1.3 no problem.

uuf6429 commented 8 years ago

Using version ^2.0 for dflydev/doctrine-orm-service-provider ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1

  • Conclusion: don't install dflydev/doctrine-orm-service-provider v2.0.1
  • Conclusion: remove pimple/pimple v1.1.1
  • Installation request for dflydev/doctrine-orm-service-provider ^2.0 -> satisfiable by dflydev/doctrine-orm-service-provider[v2.0.0, v2.0.1].
  • Conclusion: don't install pimple/pimple v1.1.1
  • dflydev/doctrine-orm-service-provider v2.0.0 requires pimple/pimple >=2.1,<4 -> satisfiable by pimple/pimple[v2.1.0, v2.1.1, v3.0.0, v3.0.1, v3.0.2].
  • Can only install one of: pimple/pimple[v2.1.0, v1.1.1].
  • Can only install one of: pimple/pimple[v2.1.1, v1.1.1].
  • Can only install one of: pimple/pimple[v3.0.0, v1.1.1].
  • Can only install one of: pimple/pimple[v3.0.1, v1.1.1].
  • Can only install one of: pimple/pimple[v3.0.2, v1.1.1].
  • Installation request for pimple/pimple == 1.1.1.0 -> satisfiable by pimple/pimple[v1.1.1]. Installation failed, reverting ./composer.json to its original content.

There problem seems obvious to me; according to packagist, v2+ requires pimple >=2.1,<4.

For now, I can "fix" this by using v1.x of the orm service provider.

simensen commented 8 years ago

OK, I misunderstood your problem. The problem is that the newest version of Silex ( 2.0.x ) uses the newer version of Pimple. However, the newest version of Silex has no stable releases yet. So you're stuck on "old Silex."

If you want to use this service provider, you're going to need to use an older version of the service provider. 2.x requires Pimple 2.x. 1.x requires Pimple 1.x. So you'll want to do something like:

composer require dflydev/doctrine-orm-service-provider:^1.0.7

If you want to be using the newest version of Silex (and a newer version of Pimple and a newer version of this service provider) you'll have to change your Silex dependency to ^2.0@dev.

uuf6429 commented 8 years ago

Well, I was mislead by the documentation. For one thing, silex 2 is not the default release (being "in dev").

Is there any way to make composer automatically select the service provider major version according to silex's? If not then maybe a small notice in the documentation (eg; the silex section in the readme) would definitely be helpful (I can do a PR if you want).

simensen commented 8 years ago

If you'd like to add a note in the readme that would be awesome. You could add a paragraph above the code sample under the Silex header like:

The current version (2.x) of this service provider can be used with Silex 2. If you are working with an older version of Silex, you should use ^1.0.7 of this service provider. This is because earlier versions of Silex use an earlier version of Pimple that is not compatible.

Or simply:

Version 2.x of this service provider is compatible with version 2.x of Silex and version 1.x of this service provider is compatible with version 1.x of Silex. The following is an example of version 2.x of this service provider and version 2.x of Silex.