PHP code example of dlepera88-php / doctrine-prefixes

1. Go to this page and download the library: Download dlepera88-php/doctrine-prefixes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dlepera88-php / doctrine-prefixes example snippets


 
// $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);