N
N
nepster-web2015-11-30 02:03:45
symfony
nepster-web, 2015-11-30 02:03:45

Symfony 2. How to beautifully organize the configuration of bundles in the database?

I decided to try working with Symfony 2 again, while working with services, I wondered how it would be nice to store configuration values ​​in the database?
For example, I have a bundle with service configurations in it:

parameters:
#    parameter_name: value

services:
    my_service:
        class:        PageBundle\Services\MyService
        arguments:    [param1, param2]

Everything is great, it works. But I would like to store param1 and param2 parameters in the database. There are a lot of docs on how to put this into separate files, I even googled an old bundle to implement such a thing: https://github.com/egzakt/UnifikDatabaseConfigBundle .
Unfortunately, the last commit 2 years ago confuses me in the bundle, but there is probably a simpler solution. Actually prompt, who as solves the given task?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-11-30
@nepster-web

yes, make a service a la ParamsProvider or something like that. And that's all. Either inject it or substitute it through expressions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question