Setting Up Doctrine

First of all, we need to require Doctrine through Composer. At the root folder of the project, the command below has to be executed:

 > php composer.phar require "doctrine/orm=^2.5"

Then, these lines will allow you to set up Doctrine:

require_once '/path/to/vendor/autoload.php';

use DoctrineORMToolsSetup;
use DoctrineORMEntityManager;

$paths = ['/path/to/entity-files'];
$isDevMode = false;

// the connection configuration
$dbParams = [
'driver' => 'pdo_mysql',
'user' => 'the_database_username',
'password' => 'the_database_password',
'dbname' => 'the_database_name',
];

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.76.89