Jump to content

Access configuration object trough dependencies for cli commands


jacob_v_dam

Recommended Posts

Hello,

I'm trying to write a command in PrestaShop 1.7.5 which should use some data from the configuration object.

I created a services.yml which registers my command, this works fine. After that I defined some arguments which should be passed to my command, this works to. But when I try to access a configuration value, the result is always null.

The arguments I use are:

$configuration: '@=service("prestashop.adapter.legacy.configuration")'
$connection: '@doctrine.dbal.default_connection'
$dbPrefix: '%database_prefix%'
$context: '@=service("prestashop.adapter.legacy.context").getContext()'

My command receives those arguments. But when I call $configuration->get('VARIABLE') it is null, even when it is set in the database and the old \Configuration object returns the right value.

Am I missing something or should I use another configuration dependency. I tried different once, but probably not the right one.

Regards,
Jacob

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...