sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Add option to add and edit Configuration parameters in admin #7931

Closed mesiarm closed 2 years ago

mesiarm commented 2 years ago

Feature Request

It would be nice to be able to sync Configuration parameters (https://symfony.com/doc/current/configuration.html#configuration-parameters), with admin and be able to edit and add them in admin. For example client could edit config parameters like app.admin_email, app.googlemaps_key in admin.

VincentLanglet commented 2 years ago

I think there is some misunderstanding.

The configuration parameters (https://symfony.com/doc/current/configuration.html#configuration-parameters) are defined in a file, sometimes with .env files too. SonataAdmin is made to create and edit entities, which are persisted in database. You won't be able to modify a file with it.

What you can do is creating your own Configuration Entity, then create a ConfigurationAdmin to create/edit then. And then, in your code, you'll do

$entityManager->getRepository(Configuration::class)->findOneBy(['name' => 'admin_email']);
mesiarm commented 2 years ago

I want reference some of configuration parameters in another configuration file (for example configuration config/packages/sonata_seo.yaml of SonataSeoBundle https://github.com/sonata-project/SonataSeoBundle). If I would use my own Configuration Entity, would it be possible to use Configuration Entity record in configuration files?