user1239713
user1239713

Reputation: 1

Doctrine Console program

I am learning Doctrine. I config doctrine 2.2.0 by Tarball Download. Now getting trouble when generating-the-database-schema. Can't use command-line tool with the code below:

<?php
// doctrine.php - Put in your application root

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\DBAL\Tools\Console\Helper\EntityManagerHelper;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Symfony\Component\Console\Helper\HelperSet;

$lib = "../DoctrineORM-2.2.0";
require $lib . '/Doctrine/ORM/Tools/Setup.php';
Setup::registerAutoloadDirectory($lib);

$paths = array("/path/to/entities-or-mapping-files");
$isDevMode = false;

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$dbParams = array(
    'dbname' => 'mydb',
    'user' => 'root',
    'password' => '',
    'host' => '127.0.0.1',
    'driver' => 'pdo_mysql'
);
$em = EntityManager::create($dbParams, $config);

$helperSet = new HelperSet(array(
    'db' => new ConnectionHelper($em->getConnection()),
    'em' => new EntityManagerHelper($em)
));

ConsoleRunner::run($helperSet);

The error here.

Fatal error: Class 'Doctrine\DBAL\Tools\Console\Helper\EntityManagerHelper' not found in E:\wamp\www\project\doctrine.php on line 30

and I can not find EntityManagerHelper.php under DoctrineORM-2.2.0\Doctrine\DBAL\Tools\Console\Helper .

Upvotes: 0

Views: 2196

Answers (1)

galymzhan
galymzhan

Reputation: 5523

Seems like EntityManagerHelper is under different namespace:

namespace Doctrine\ORM\Tools\Console\Helper;

Upvotes: 2

Related Questions