Reputation: 2895
I have service in bundle
@sonata.page.twig.extension
it is private.
I need set is as public.
Try 1.
Sonata\PageBundle\Twig\Extension\PageExtension:
alias: "@sonata.page.twig.extension"
public: true
get
InvalidArgumentException
Unable to replace alias "Sonata\PageBundle\Twig\Extension\PageExtension" with actual definition "@sonata.page.twig.extension".
Try 2
mea.sonata.page.twig.extension:
alias: "@sonata.page.twig.extension"
public: true
same error
Upvotes: 1
Views: 1292
Reputation: 1253
Without it, you are telling the container to pass the string sonata.page.twig.extension.
With it, you are telling the container to pass the service sonata.page.twig.extension.
From the documentation, see the following comment in the code : https://symfony.com/doc/current/service_container.html
# explicitly configure the service
App\Service\MessageGenerator:
arguments:
# the '@' symbol is important: that's what tells the container
# you want to pass the *service* whose id is 'monolog.logger.request',
# and not just the *string* 'monolog.logger.request'
$logger: '@monolog.logger.request'
Upvotes: 1
Reputation: 2895
OK found solution
Sonata\PageBundle\Twig\Extension\PageExtension:
alias: 'sonata.page.twig.extension'
public: true
Why sometimes @sonata.page.twig.extension sometimes sonata.page.twig.extension
Upvotes: 0