Skip to content

Say which container $this->get() resolves against in the front office - #2164

Draft
boo-code wants to merge 1 commit into
PrestaShop:9.xfrom
boo-code:docs/front-office-container-scope-29013
Draft

Say which container $this->get() resolves against in the front office#2164
boo-code wants to merge 1 commit into
PrestaShop:9.xfrom
boo-code:docs/front-office-container-scope-29013

Conversation

@boo-code

@boo-code boo-code commented Sep 2, 2026

Copy link
Copy Markdown
Questions Answers
Branch? 9.x
Description? The Symfony Services section of modules/concepts/services describes config/services.yml and $this->get() with no indication that both only apply to the back office and to pages already migrated to Symfony. The front office caveat exists but sits under Services in Legacy environment, several screens further down, which is where a reader lands only after the call has already thrown. Adds a warning notice at the top of the section naming what resolves where, and linking to the existing section.
Fixed ticket? Related to PrestaShop/PrestaShop#29013
Sponsor company

Why here

#29013 is a module author following the top of this page and getting
You have requested a non-existent service "twig" from a front office hook. Twenty-one comments and three
community members later, the answer was the paragraph further down the same page. The page is not wrong;
the scoping is stated too late to help.

The facts the notice states, measured on 9.2

A probe module hooked on displayFooterProduct, hit through a real front office product page:

$this->get('router')                    ServiceNotFoundException: non-existent service "router"
$this->get('twig')                      NULL           (9.0+ routes it to getTwig())
$this->get('translator')                ServiceNotFoundException
$this->get('prestashop.adapter.legacy.context')   PrestaShop\PrestaShop\Adapter\LegacyContext
$this->getTwig()                        NULL
SymfonyContainer::getInstance()         NULL
container class                         FrontContainer, 109 services

The 109 are Doctrine plus prestashop.adapter.* / prestashop.core.* entries; the only translation-ish
one is prestashop.translation.translator_language_loader. No count is quoted in the notice, since it
would go stale.

The Symfony Services section describes config/services.yml and $this->get()
without saying they only apply to the back office and to migrated pages. The
front office caveat is further down the page, under Services in Legacy
environment, which is where readers land only after the call has already
failed.
@github-actions github-actions Bot added the 9.x label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant