[SOLVED] Website Settings Service


#1

I got a question about the Website Settings Service located under \Pimcore\Config\Config.

What is the service name for it? I am trying to inject it into one of my service but i need the service definition as a argument.

I know i could use the autowiring feature from Symfony, but it would still be nice to know :wink:

Best regards

Sebastian


#2

Ok apparently it cannot be autowired:

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "myservice": argument "$config" of method "MyService::__construct()" references class "Pimcore\Config\Config" but no such service exists.

The question is now, how can i access website settings inside of a service?


#3

Try to use \Pimcore\Config::getWebsiteConfig() :slight_smile:

BR


#4

Hey scrummer,

thank you, just found that method some minutes ago when looking at the core code :wink:


#5

see also https://pimcore.com/docs/5.x/Development_Documentation/Tools_and_Features/Website_Settings.html