2

I'm currently using the stof/doctrine-extensions-bundle in one of my Symfony projects and this bundle requires gedmo/doctrine-extensions. The latest version in gedmo/doctrine-extensions is failing. But the solution is in one of the sibling branches v2.4.x.

https://github.com/Atlantic18/DoctrineExtensions/commit/0b7bdbefd3d166def27928dcd62ab67c11c8f172

Is it possible to add this branch in the requirements of stof/doctrine-extensions-bundle or should I wait till the owner of the bundle creates a new tag?

rob006
  • 21,383
  • 5
  • 53
  • 74
Kenchopa
  • 99
  • 11
  • 1
    You wouldn't modify composer.lock in any case, only composer.json. You can try to require gedmo/doctrine-extensions:2.4.* as your own project's dependency and see if that is compatible with stof/doctrine-extensions-bundle's requirements. – Devon Bessemer Jun 07 '18 at 13:58

2 Answers2

3

Reviewing stof/doctrine-extensions-bundle's composer.json require block:

"gedmo/doctrine-extensions": "^2.3.4"

It supports versions 2.3.4 to <=3.0.0. So you should be able to install a 2.4.x version in your project without issue. (Read about composer's version constraints here)

You should not manually modify a composer.lock file and you should not modify their composer.json file in your vendor directory. You can require different versions of dependencies in your own project as long as they are compatible with other dependency requirements.

Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95
  • This is correct. As an additional note, you can add `"gedmo/doctrine-extensions":"^2.4"` to your composer.json (not the lock-file!) or use the command line: `composer require gedmo/doctrine-extensions:"^2.4"` which will do the same thing. This should not affect your stof/doctrine-extensions-bundle unless you choose a version that conflicts somehow. Then things become more difficult. – dbrumann Jun 07 '18 at 14:07
  • Thanks for your answer, but I'm currently having trouble with the latest version of gedmo/doctrine-extensions. The version 2.4.35 is having issues in the Nested tree class. So based on your anwser I assume I should wait till the owner of gedmo tags a new version. – Kenchopa Jun 07 '18 at 14:13
  • Ah, you meant a literal 2.4.x branch. I thought you meant it was just in a 2.4 version. You'd want to use the 2.4.x-dev like rob pointed out. – Devon Bessemer Jun 07 '18 at 14:16
2

Since this fix has not been released yet, you need to use branch for this dependency. You can do this by calling:

composer require "gedmo/doctrine-extensions:2.4.x-dev"

This will add this dependency to composer.json of your project. But be careful with this and treat this only as a temporary workaround, till stable version with this fix will be released. Using branches for dependencies is usually not recommended.

rob006
  • 21,383
  • 5
  • 53
  • 74
  • Yep. This works but using a dev branch could lead to amusing results as the branch is updated. A more brute force approach is to fork the dev branch and point composer to it. This will basically freeze the dev branch and isolate you from any day to day changes. – Cerad Jun 07 '18 at 14:23
  • @Cerad This should not be a big problem as long you're not running `composer update` every day/hour (which could be a problem even with stable releases) - package version will be locked in `composer.lock`. – rob006 Jun 07 '18 at 14:26
  • True enough. However Symfony does tend to release point versions on a rather frequent basis. And it's easy to forget that doing an update might break something seemingly unrelated. – Cerad Jun 07 '18 at 15:08