I have tried to follow the "steps" detailed on the website but i couldn't make it work: http://docs.doctrine-project.org/en/latest/reference/configuration.html
I have downloaded the doctrine package. Then i have installed it using PEAR.
Now, i create a file called "test.php" with the following content:
//loding Setup from the doctrine package...
require 'vendor/Doctrine/ORM/Tools/Setup.php';
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR();
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array("/path/to/entities-or-mapping-files");
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'user' => 'admin',
'password' => 'mypass',
'dbname' => 'test',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$em = EntityManager::create($dbParams, $config);
// or if you prefer yaml or xml
//$config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration($paths, $isDevMode);
What else should i do to make it work? I can not currently do something like:
print_r($em->getRepository("User"));
It shows me many warnings, for example:
Class User does not exist and could not be loaded in
Warning: array_reverse() expects parameter 1 to be array, boolean given in
Warning: Invalid argument supplied for foreach() in ..../Doctrine/ORM/Mapping/ClassMetadataFactory.php
etc. The first one i guess is the key.
Something is missing but i dont know what. Thanks.