2017 © Pedro PelĂĄez
 

symfony-bundle database-config-bundle

Allows management of Symfony's container configuration from the database

image

carlinhus/database-config-bundle

Allows management of Symfony's container configuration from the database

  • Wednesday, December 14, 2016
  • by carlinhus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

carlinhusDatabaseConfigBundle

Attention! This bundle was previously know as FlexyDatabaseConfigBundle. Make sure to update your composer.json project file to reflect the name change., (*1)


carlinhusDatabaseConfigBundle allows you to store configurations from the configuration tree of a bundle and parameters in a database table. Those configurations and parameters will override those defined in the app/config/config.yml and app/config/parameters.yml files., (*2)

Configurations are all cached using Symfony's container caching mechanism and do not hit the database., (*3)

Content

  • Installation
  • How to use

Installation

  1. Add this to your composer.json :
    "require": {
        "carlinhus/database-config-bundle": "dev-master"
    }
  1. Run a composer update :
composer update
  1. Register the bundle in your AppKernel.php :
public function registerBundles()
{
        new Carlinhus\DatabaseConfigBundle\CarlinhusDatabaseConfigBundle(),
}
  1. Extend the getContainerBuilder() method in AppKernel.php :
use Carlinhus\DatabaseConfigBundle\DependencyInjection\Compiler\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
...
protected function getContainerBuilder()
{
        return new ContainerBuilder(new ParameterBag($this->getKernelParameters()));
}
  1. Update the database schema :
app/console doctrine:schema:update --force

How to use

Add a configuration to the database

carlinhusDatabaseConfigBundle reproduces the configuration tree of a bundle in the database table named container_config. If you want to add a configuration in the database table, you have to first add the extension name in the container_extension table. After that, you will have to add each parent node of the configuration tree that leads to the configuration you have to override., (*4)

For example, if you have the following configuration and you want to override project_title :, (*5)

twig:
    globals:
         project_title: My project title

First, we have to add twig to the container_extension table :, (*6)

id name
1 twig

Then, we add every node that leads to project_title in the container_config table :, (*7)

id parent_id extension_id name value
1 NULL 1 globals NULL
2 1 1 project_title My New Project Title

Add a parameter to the database

Parameters are stored in the container_parameter table in the database. To add a parameter to the database, you just add its name and value to the table., (*8)

id name value
1 custom_parameter My custom parameter value

Clear the cache

As database configurations and parameters are cached, you will need to do a app/console cache:clear every time you wish to reload the configuration coming from the database., (*9)

The Versions

14/12 2016

dev-master

9999999-dev https://github.com/carlinhus/databaseConfigBundle

Allows management of Symfony's container configuration from the database

  Sources   Download

MIT

The Requires

 

by Hubert Perron
by Frédéric Hamelin
by Luis Fernando Granados
by Guillaume Petit
by Vincent Beauvivre

database container config symfony carlinhus

14/12 2016

1.0.2

1.0.2.0 https://github.com/carlinhus/databaseConfigBundle

Allows management of Symfony's container configuration from the database

  Sources   Download

MIT

The Requires

 

by Hubert Perron
by Frédéric Hamelin
by Luis Fernando Granados
by Guillaume Petit
by Vincent Beauvivre

database container config symfony carlinhus

14/12 2016

1.0.1

1.0.1.0 https://github.com/carlinhus/databaseConfigBundle

Allows management of Symfony's container configuration from the database

  Sources   Download

MIT

The Requires

 

by Hubert Perron
by Frédéric Hamelin
by Luis Fernando Granados
by Guillaume Petit
by Vincent Beauvivre

database container config symfony carlinhus

14/12 2016

1.0.0

1.0.0.0 https://github.com/Carlinhus/databaseConfigBundle

Allows management of Symfony's container configuration from the database

  Sources   Download

MIT

The Requires

 

by Hubert Perron
by Frédéric Hamelin
by Luis Fernando Granados
by Guillaume Petit
by Vincent Beauvivre

database container config symfony carlinhus