php - How to store system settings in entity -


I am currently running the system, which should be editable by the settings administrator. He can not add them, but only chooses / edits from the current one.

All backends are done in Sonata .

Settings class:

  class system settings {/ ** * @var integer * * @ORM \ column (name = "id", type = "integer") * @ORM \ Id * @ORM \ Generated Value (strategy = "auto") * / Private $ ID; / ** * @ORM \ column (name = "key", type = "string", faucet = true) * / private $ key; / ** * @ORM \ column (name = "value", type = "string", faucet = true) * / personal $ value; }  

The problem is that I have different price types to store, I have some booleans, lists, integer, etc. For example, I want to display the array of languages ​​as a list, but when it comes to setting the "Post on page" setting, then the user should write any integer he wants. Is there any proper way to store and display it?

The problem with using this method of storage is that you said, You want nested configuration, and eventually you will write on complex questions to select and update embedded JSON strings (believe me, I know).

I can not give you an exact solution because I'm still trying to solve a problem. Although I have yet to find some solutions:

  • Using MongodiBi since it basically stores data in JSON, so it's arbitrary datatypes (at least Scalar and within the scope of arrays) is more favorable to accumulate.

  • Or dynamic file configuration which is a writable file that is used in XML or JSON, which has a format for storing arbitrary data. One problem you can run in though it is that the server software is running on many machines, however, if you can apply the solution first, then it is essentially the same.

In all cases, the configuration should be indefinitely so far as there is something wrong, there should be a permanent defaults for it because it will fall back. Looking to adopt Component \ Config component


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -