idea-php-symfony2-plugin icon indicating copy to clipboard operation
idea-php-symfony2-plugin copied to clipboard

Renaming templates through refactoring breaks references to it

Open stof opened this issue 6 years ago • 3 comments

when using the Refactor > rename feature to rename a template, PHPStorm properly identifies the render() call as needing to be updated during the refactoring (thanks to this plugin AFAICT). But the refactoring being performed is wrong. I had a template named @Web/Space/Main/delete_confirmation.html.twig. When renaming the file to delete.html.twig in the same folder, I expected the render call to be updated to @Web/Space/Main/delete.html.twig but it was updated to delete.html.twig instead.

stof avatar Jun 20 '18 09:06 stof

This is due to a simple PSIReference that will only replace the references' name with the PSIFiles' name. To implement the behaviour, we should add a rename handler.

Ref: https://github.com/Haehnchen/idea-php-symfony2-plugin/blob/147d6d0951ac64a231e89f7a1e334e2e2d80e2ea/src/main/java/fr/adrienbrault/idea/symfony2plugin/templating/TemplateReference.java#L15

cedricziel avatar Jun 20 '18 09:06 cedricziel

Hello, I have the same problem with PhpStorm 2021.3.2 and Symfony Support plugin 0.23.213 (in a Symfony 6 project). Do you think you could implement the solution you propose ? Or maybe I can try to do it and submit a pull request ?

celinederoland avatar Feb 18 '22 05:02 celinederoland

Related: when moving a template the {% extends %} paths inside the template will become relative instead of absolute which also breaks things.

dirkjf avatar Mar 15 '24 13:03 dirkjf