dlepera88-php / doctrine-prefixes
Set database and/or table prefix.
0.0.3
2019-12-17 19:02 UTC
Requires
- php: >=7.0
- doctrine/event-manager: ^1.1
- doctrine/orm: ^2.6
Requires (Dev)
- phpunit/phpunit: ^8.4
This package is auto-updated.
Last update: 2024-12-18 06:00:18 UTC
README
In some cases, we need to install a web application on shared hosts. On shared hosts, database names usually have a prefix, like cPanel, for example. Eg: etc_dbname.
So, I make this package. I hope this help u.
Basic Usage
<?php // $connectionOptions and $config set earlier /** @var $connectionOptions */ /** @var array $config */ $evm = new \Doctrine\Common\EventManager; // Database Prefix $database_prefix = new \DoctrinePrefixes\DatabasePrefix('db_'); $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $database_prefix); // Table Prefix $table_prefix = new \DoctrinePrefixes\TablePrefix('prefix_'); $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $table_prefix); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $evm);