Skip to content

Comments

[TwigComponent] Add support for anonymous component name resolution in other bundle#3295

Merged
Kocal merged 1 commit intosymfony:2.xfrom
Phil23:1998/anonymous-name-resolution-bundles
Feb 8, 2026
Merged

[TwigComponent] Add support for anonymous component name resolution in other bundle#3295
Kocal merged 1 commit intosymfony:2.xfrom
Phil23:1998/anonymous-name-resolution-bundles

Conversation

@Phil23
Copy link
Contributor

@Phil23 Phil23 commented Jan 14, 2026

Q A
Bug fix? no
New feature? yes
Deprecations? no
Documentation? no
Issues Fix #1998
License MIT

In a recent PR (#3169), @andyexeter added support for using index.html.twig as a component template when the component is placed in a directory named after itself. However, it seems to miss the implementation for external bundles. This PR extends the change so that anonymous component templates in other bundles can also use this naming pattern.

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Jan 14, 2026
@carsonbot carsonbot changed the title Add support for anonymous component name resolution in other bundle Add support for anonymous component name resolution in other bundle Jan 14, 2026
@Phil23 Phil23 force-pushed the 1998/anonymous-name-resolution-bundles branch from 1e75f59 to 0e77a6a Compare January 14, 2026 09:10
@smnandre
Copy link
Member

Hi @Phil23

Could you add a few tests for the edge cases... that will mainly be used to decide once and keep the same behaviour afterward.

<twig:Acme:Foo:Index /> 

<twig:Acme:Foo:index />

<twig:Acme:Index:index />

( depending on the various possibilities (there is or not a template, caps / lower) )

Also let's add a line in the CHANGELOG (the one in the src/TwigComponent directory)

Minor/personal note here: this will work (and thank you for this PR by the way 🤝 )..

... I would still not recommand "officially" this trick to bundle maintainers.. or I would recommand them to not abuse it, and keep it "inside" their component structure instead of using this for the "main ones" -- button for instance..
... as the differences with how the Twig and Live component are handled could lead to frustrations I guess.

@Phil23
Copy link
Contributor Author

Phil23 commented Jan 19, 2026

@smnandre Thank you for the feedback.

I added several edge cases to the unit test.

I also added the changelog entry. I wasn't sure about the version number, though.

@smnandre
Copy link
Member

Thank you for this nice first PR @Phil23 🎉

@smnandre smnandre added Status: Reviewed Has been reviewed by a maintainer Feature New Feature TwigComponent and removed Bug Bug Fix labels Jan 19, 2026
@carsonbot carsonbot changed the title Add support for anonymous component name resolution in other bundle [TwigComponent] Add support for anonymous component name resolution in other bundle Jan 19, 2026
@Phil23 Phil23 requested a review from smnandre January 20, 2026 07:45
@carsonbot carsonbot removed the Status: Reviewed Has been reviewed by a maintainer label Jan 20, 2026
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jan 23, 2026
@Kocal Kocal force-pushed the 1998/anonymous-name-resolution-bundles branch from e121b9d to fe1d716 Compare February 8, 2026 16:48
…n external bundle

Co-authored-by: Simon André <smn.andre@gmail.com>
@Kocal Kocal force-pushed the 1998/anonymous-name-resolution-bundles branch from fe1d716 to 2f2c53e Compare February 8, 2026 16:49
@Kocal
Copy link
Member

Kocal commented Feb 8, 2026

Thank you @Phil23.

@Kocal Kocal merged commit 4a14dba into symfony:2.x Feb 8, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New Feature Status: Reviewed Has been reviewed by a maintainer TwigComponent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Anonymous Name Resolution Fallback

4 participants