Repository navigation
Conversation
Extensions' controllers that extend TwigAwareController are registered by the generated config/services_bolt.yaml, which has no `$defaultLocale` bind (only the project's config/services.yaml has it). Autowiring the #[Required] setAutowire() therefore failed with "argument $defaultLocale ... is type-hinted string, you should configure its value explicitly", so the container could not be compiled. Take the value from the `locale` parameter with #[Autowire], as the bind does.
Vondry
added a commit
to Vondry/bolt-llms-txt
that referenced
this pull request
Oct 5, 2026
Replace the reference-extension scaffold with the shared parts of the hand-written llms.txt implementations, so a site only provides a Twig template and optional config (enabled, template, locale, max_age): - /llms.txt route rendering the theme's template, falling back to a shipped generic one; route defaults can serve more files such as /llms-full.txt - text/plain response, public for max_age seconds with an xxh128 ETag and 304, without a firewall entry; private for logged-in users and whenever a cookie is set - rendering in a configurable locale, checked against the site's locales - html_to_text, markdown_label and markdown_url Twig filters - PHPUnit tests, and ECS, PHPStan, Rector and PHPUnit in CI on PHP 8.2-8.5 The controller overrides TwigAwareController::setAutowire() only to add #[Autowire] to $defaultLocale, which extension classes can't get from the project's binds. bolt/core#3815 fixes this in core; the override is marked for removal once that is released.
Member
|
Using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
My extension's controller extends
TwigAwareControllerto userenderTemplate(), so it can render templates from the theme. Installing the extension breaks the container:The extension doesn't need
$defaultLocaleitself. It comes with extendingTwigAwareController, whose#[Required]setAutowire()must be fully autowirable. The value only comes from thebindin the project'sconfig/services.yaml. Extension classes are registered by the generatedconfig/services_bolt.yaml, which has no binds. So any extension controller extendingTwigAwareControllerfails the same way.What
Add
#[Autowire(param: 'locale')]to$defaultLocale. It's the same value the bind already gives, so nothing changes for existing projects.