dev-master
9999999-devSettings from db
MIT License
The Requires
- php >=5.3.2
- symfony/framework-bundle ~2.3
by Fatih GÜRSOY
config symfony2 setting
Settings from db
This bundle helps you to store your settings for application layer. This settings are stored based on scope such as general, user groups, user and can be accessedfrom any layer later., (*1)
An example:, (*2)
Let say we have 30 quota available for Math class:, (*3)
{ "id": 1, "scope_group_type": "labs", "scope_by_id": 2, "section": "registration", "name": "quota", "value": 30, "created_at" : "2015-08-13 00:00:00", "updated_at" : "2015-08-13 00:00:00" }
You can install via composer., (*4)
composer require fg/config-bundle
or add to require section of composer.json:
, (*5)
"fg/config-bundle": "dev-master"
public function registerBundles() { $bundles = array( // ... new Fg\Bundle\ConfigBundle\FgConfigBundle() ); // ... }
php app/console doctrine:schema:update --force
There are three different ways to create a new setting., (*6)
You can create a new setting by runnig php app/console fg:config:create
command from cli., (*7)
You can create a new setting by calling the create method of SettingService
which previously passed to service container., (*8)
$settingService = $this->get('fg_config.service.setting_service'); #create($name, $value, $scopeGroupType, $section, $scopeById = 0) $setting = $settingService->create('test', 'test', 'general', 'general')
http://localhost/path/to/management/setting
, (*9)
... $settingService = $this->get('fg_config.service.setting_service'); $settingObject = $settingService->getAllSettingByScope('quota', 'labs', 'registration', 2); ...
... {{ get_setting('phone') }} //get setting object of name phone {{ get_setting_value('phone') }} //get value of name phone ...
Settings from db
MIT License
config symfony2 setting