doctrine / phpcr-odm

Doctrine PHPCR ODM
http://www.doctrine-project.org/projects/phpcr-odm.html
MIT License
183 stars 97 forks source link

Dependency in composer.json cannot be resolved #356

Closed simondeeley closed 10 years ago

simondeeley commented 11 years ago

The dependency "phpcr/phpcr-implementation" cannot be resolved when using composer. It would seem that phpcr/phpcr-implementation does not exist anywhere that I can find..?

Is this dependency required any longer?

dbu commented 11 years ago

phpcr-implementation is a virtual package denoting that we need an implementation of phpcr. it is provided for example by https://packagist.org/packages/jackalope/jackalope (using in turn the jackalope-transport virtual package provided by jackalope-jackrabbit and jackalope-doctrine-dbal). the search on packagist seems to not find packages by the provides information - i created https://github.com/composer/packagist/issues/350

but long explanations apart, i never saw this issue. i think usually composer just randomly picks either jackalope-doctrine-dbal or jackalope-jackrabbit for you. which is not ideal either as both need a bit of configuration. so you want to add one of them into your composer.json. which installation instructions did you follow? we might improve them to make things clearer.

simondeeley commented 11 years ago

Thanks for the explanation. I'm currently using a custom-worked library based on Silex and then adding Doctrine PHPCR-ODM (this repo.) along with Jackalope Jackrabbit phpcr for the "heavy" work on the back end. I guess I can add a "provides" in my package composer to trick it into thinking the implementation is there.

Alternatively what about adding "suggests" into your composer with a list of a few phpcr repos?

dbu commented 11 years ago

but we already have the suggests: https://github.com/doctrine/phpcr-odm/blob/master/composer.json#L25

can you gist your composer.json that does not work? if you have jackalope/jackalope-jackrabbit in it, i don't see why that would not install. maybe a problem of minimal-stability or a beta version of phpcr-odm?

simondeeley commented 11 years ago

{ "type": "project", "require": { "php": ">=5.3.3", "silex/silex": "~1.0", "silex/web-profiler": "~1.0", "symfony/class-loader": "~2.2", "symfony/console": "~2.2", "symfony/monolog-bridge": "~2.2", "symfony/security": "~2.2", "symfony/twig-bridge": "~2.2", "doctrine/phpcr-odm": "1.0.*", "jackalope/jackalope-doctrine-dbal": "1.0.*" }, "autoload": { "psr-0": { "": "src/" } } }

This is the composer.json I'm using. I've tried adding a minimum stability of dev but it unfortunately breaks the web profiler component by throwing a class exception on a function. It seems that the dev repos of Symfony have changed the way a few things are handled and as such I wanted to avoid them to ensure compatibility with other repos.

dbu commented 10 years ago

hi @donottumbledry does the issue still appear? note that you are requiring jackalope-doctrine-dbal, not jackalope-jackrabbit as you said above, but both should work.

do you have a recent version of composer? do you maybe have some sort of cache that might not have seen the latest tags of jackalope?

you should not need dev stability to solve this case, but just for further reference note that you can add @dev to the end of a requirement line to get the dev version of just that dependency without altering the global minimum-stability. this however is not inherited to the dependencies of that dependency, so you need to list everything you want in dev stability explicitly...

simondeeley commented 10 years ago

Yes thanks, the issue is now resolved. I dug into the composer docs to find "prefer-stable" tag which forced a compatible build of all the dependencies. I wasn't aware that the @dev only applied to that dependency - good thing to note for future :)