APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

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

Open vialcollet opened this issue 1 year ago • 1 comments

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.

vialcollet avatar Jul 05 '24 13:07 vialcollet

Hi any potential feedback on this topic?

vialcollet avatar Sep 04 '24 13:09 vialcollet

Hello @vialcollet, I'm sorry, but I won't have enough time to support issues on outdated symfony versions.

it seems that rhe change you are refering to is 4 year old : https://github.com/APY/APYDataGridBundle/commit/f569a54dd3c4645def6a1c005eec1320f03c7319

I would suggest to use an older tag if you want to maintain your project on sf 3

npotier avatar Feb 06 '25 16:02 npotier