Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Symfony 5 #122

Closed
tacman opened this issue Dec 3, 2019 · 6 comments · Fixed by #127
Closed

Allow Symfony 5 #122

tacman opened this issue Dec 3, 2019 · 6 comments · Fixed by #127

Comments

@tacman
Copy link
Contributor

tacman commented Dec 3, 2019

Symfony5 is out, not sure what's needed to update this bundle. My attempt to simply bump the dependencies didn't work, can we drop PHP5 support?

Also, I think symfony/templating has been deprecated in favor of twig/twig, but I'm not sure how to provide BC for this.

@mikeploeger
Copy link

+1

@mikeploeger
Copy link

mikeploeger commented Dec 5, 2019

Theres occurring a problem.
This library relies on the Twig_Extension Bundle.

But the Twig/Extensions Bundle is abandoned.
"WARNING: This repository is abandoned in favor of Twig Core Extra extensions."
Source: https://github.com/twigphp/Twig-extensions

The function, that this bundle here is using isn't in the Twig Core Extra extension:
"DateExtension: time_diff filter -> no equivalent"

Has anybody a solution how to make this bundle (or a similar bundle) compatible?

@tacman
Copy link
Contributor Author

tacman commented Dec 5, 2019

Really, timeago.js may be part of the solution here. But I'm unclear on what the best practices are using Webpack Encore and requiring a javascript library in a bundle.

What I've been doing is

yarn add timeago

Then

Any idea on how to require a js library from within a Symfony Bundle, and integrate it (automatically?). Then the twig extension becomes easy, at least for that part.

This was referenced Dec 18, 2019
@napestershine
Copy link

$ composer require knplabs/knp-time-bundle
Using version ^1.10 for knplabs/knp-time-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  
!!   // Clearing the cache for the dev environment with debug                       
!!   // true                                                                        
!!  
!!  14:19:35 CRITICAL  [php] Uncaught Error: Class 'Twig_Extension' not found ["exception" => Error { …}]
!!  
!!  In TimeExtension.php line 20:
!!                                                                         
!!    Attempted to load class "Twig_Extension" from the global namespace.  
!!    Did you forget a "use" statement?                                    
!!                                                                         
!!  
!!  cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
!!  
!!  
Script @auto-scripts was called via post-update-cmd

Installation failed, reverting ./composer.json to its original content.

@mikeploeger
Copy link

$ composer require knplabs/knp-time-bundle
Using version ^1.10 for knplabs/knp-time-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! // Clearing the cache for the dev environment with debug
!! // true
!!
!! 14:19:35 CRITICAL [php] Uncaught Error: Class 'Twig_Extension' not found ["exception" => Error { …}]
!!
!! In TimeExtension.php line 20:
!!
!! Attempted to load class "Twig_Extension" from the global namespace.
!! Did you forget a "use" statement?
!!
!!
!! cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]
!!
!!
Script @auto-scripts was called via post-update-cmd

Installation failed, reverting ./composer.json to its original content.

Thats because you need to install twig extension bundle (composer require twig/extensions)

But Twig Extension Bundle is incompatible with SF5 ("Your requirements could not be resolved to an installable set of packages.")

So this knp time bundle can't be installed right now.

@weaverryan
Copy link
Collaborator

Should be better in v1.11.0. If you have any problems, please open a new issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants