php-translation / symfony-bundle

Symfony integration for Translations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improving resolution of software dependencies

elfring opened this issue · comments

I would like to update the dependencies also for this software once more.
But I stumble on the following information.

root@6f46d94d1431:/var/www/html# ./composer.phar require php-translation/symfony-bundle
…
Using version ^0.12.3 for php-translation/symfony-bundle
./composer.json has been updated
Running composer update php-translation/symfony-bundle
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "^5.2"
Updating dependencies
…
Symfony operations: 2 recipes (abb67eaaeb7f1c1917083c2eea87babe)
  - Configuring symfony/translation (>=3.3): From github.com/symfony/recipes:master
  -  WARNING  php-translation/symfony-bundle (>=0.10): From github.com/symfony/recipes-contrib:master
…
    Do you want to execute this recipe?
…
    (defaults to n): y
  - Configuring php-translation/symfony-bundle (>=0.10): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
…
!!  In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
!!                                                                                 
!!    The service "Translation\Bundle\Controller\SymfonyProfilerController" has a  
!!     dependency on a non-existent service "profiler". Did you mean this: "twig.  
!!    extension.profiler"?                                                         
!!                                                                                 
!!  
!!  
Script @auto-scripts was called via post-update-cmd

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

How are the chances to clarify such a software situation?

Hi @elfring, it looks like you miss symfony/profiler-pack which actually contains the profiler service mentionned in the error message. You can install it with this command: composer require --dev symfony/profiler-pack

  • Can the “translation bundle” ever work without an extra “profiler package”?
  • Would you expect that the software dependencies will be completed automatically?

It seems that the desired software installation can succeed together with the additional parameter “--dev symfony/profiler-pack”.

Yes, the bundle needs the symfony/web-profiler-bundle package at least. It's not listed as hard dependency, only dev. May be we should fix that. @bocharsky-bw WDYT?

Yeah, looks like an edge case, but should be fixed I think. I think we have a few options:

  1. Make symfony/web-profiler-bundle as a main dependency for this bundle
  2. Disable using web profiler by default - but it will make it harder to reveal this feature out of the box

I see we enable it by default in the recipe: https://github.com/symfony/recipes-contrib/blob/ff7313b337a4c0ec894684f71b62240a31816e9f/php-translation/symfony-bundle/0.10/config/packages/dev/php_translation.yaml#L3 . So, in theory, if we will set it to false - this error will be gone. I would probably lean toward the 1st option as most probably almost everyone has that profiler installed.

Though, there's another 3rd possible option: we could make that Profiler dependency in Translation\Bundle\Controller\SymfonyProfilerController optional, i.e. stop requiring it in the constructor and do it via a setter. Also, we could add a getter for this and check if the Profiler is null, and if it is - throw an exception with a description error message saying something like "Install symfony/web-profiler-bundle that is required for using web profiler feature" if devs somehow will try to use it without symfony/web-profiler-bundle installed. Probably this one option will be the best here, because make that bundle as a main dep isn't perfect I think

Thoughts?

🤔 I imagine that there are applications to consider which would be preferred to run in operation modes without additional components for profiling software.

Agree, and I suppose this was your case too? And we should be careful with adding more required dependencies, so the 3rd option would be better IMO

Hey @elfring, I made the fix in #440 - could you give it a try, please?