val/doctrine-table-prefix-service-provider

Doctrine event listener to dynamically add a table prefix.

Installs: 51

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/val/doctrine-table-prefix-service-provider

v1.0.0 2014-03-31 10:34 UTC

This package is not auto-updated.

Last update: 2025-10-11 20:56:49 UTC


README

Doctrine event listener to dynamically add a table prefix.

Features

  • Add a table prefix for any configured database directly in the configuration array.
  • Framework agnostic (since it extends Pimple).

The TablePrefix code is totally taken from the documentation.

Installation

composer require val/doctrine-table-prefix-service-provider

Usage

Assuming $app is an instance of Pimple, Silex\Application or Cilex\Application.

Configuration

Single DB

<?php

$app['db.options']['prefix'] = 'prefix_';

Multiple DBs

<?php

$app['dbs.options']['first']['prefix'] = 'first_';
$app['dbs.options']['second']['prefix'] = 'second_';

Registration

Pimple

<?php

use Val\Pimple\Provider\DoctrineTablePrefixServiceProvider;

new DoctrineTablePrefixServiceProvider()->register($app);

Silex

<?php

use Val\Silex\Provider\DoctrineTablePrefixServiceProvider;

$app->register(new DoctrineTablePrefixServiceProvider());

Cilex

<?php

use Val\Cilex\Provider\DoctrineTablePrefixServiceProvider;

$app->register(new DoctrineTablePrefixServiceProvider());