I tried installing doctrine2 orm from composer, it was successfull, I setup my bootstrap.php as shown below
<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
// bootstrap.php
require_once "vendor/autoload.php";
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array(ROOT.DS.'library'.DS.'doctrine/entities/');
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'meso',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
?>
and here is my cli-config.php
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();
return ConsoleRunner::createHelperSet($entityManager);
?>
When I tried creating orm mapping into my entities folder using the command below on cli, it throws this error "Call to undefined function in GetEntityManager() in cli-config.php on line 8"
> php vendor/doctrine/orm/bin/doctrine orm:convert-mapping xml ./path/to/entities/
I found out the solution to my problem, I havent created a getEntitymanager function that calls for EntityManager instance. I did that in my bootstrap.php