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

Compatibility Issue with Symfony 3.4 and getRootNode() Method in TreeBuilder #1110

Open
vialcollet opened this issue Jul 5, 2024 · 0 comments

Comments

@vialcollet
Copy link

Description:
We encountered a fatal error when trying to clear the cache after updating to APY/DataGridBundle version 4.0 on a Symfony 3.4 project. The issue seems to be due to the getRootNode() method in the TreeBuilder class, which does not exist in Symfony 3.4.

Error Message:

Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "getRootNode" of class "Symfony\Component\Config\Definition\Builder\TreeBuilder". in /srv/app/vendor/apy/datagrid-bundle/DependencyInjection/Configuration.php:21

Steps to Reproduce:

  1. Start with a Symfony 3.4 project.
  2. Require APY/DataGridBundle version 4.0 using Composer.
  3. Run composer update.
  4. Attempt to clear the cache using php bin/console cache:clear --no-warmup.
  5. Observe the fatal error.

Expected Behavior:
The bundle should either be compatible with Symfony 3.4, or the composer.json file should specify a Symfony version requirement that prevents installation on incompatible versions.

Actual Behavior:
The bundle attempts to use getRootNode(), which is available from Symfony 4.2 onwards, thus causing a fatal error in Symfony 3.4 environments.

Possible Solutions:

  1. Update the composer.json to reflect the correct Symfony version requirements.
  2. Adjust the Configuration.php to check for Symfony version and use either getRootNode() or the deprecated root() method accordingly.

Additional Context:
Updating to a newer version of Symfony might not be feasible for all projects immediately due to extensive dependencies and potential backward compatibility issues. A clarification in the documentation or adjustment in the code to maintain backward compatibility would be beneficial for developers relying on older Symfony versions.

Thank you for looking into this issue. Any guidance or updates on how to handle or patch this would be greatly appreciated.

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

No branches or pull requests

1 participant