1

I'm trying to setup doctrince 2 to my own CMS. I placed my folder Doctrince to /var/www/html/mysite.com/, where 'index.php' and 'config.php' are placed.

My config.php likes below:

<?php
ini_set("display_errors",true);
date_default_timezone_set("Asia/Ho_Chi_Minh");
define('TIMER_START', microtime( true ) );  
define( 'DS', DIRECTORY_SEPARATOR );
define( 'ROOT_DIR', realpath( dirname( __FILE__ ) ) . DS );
define('MNGDIR', ROOT_DIR.'manager'.DS );
define('HDLDIR' , ROOT_DIR.'handler'.DS );
define('TPLDIR', ROOT_DIR.'template'.DS );  
define('MDLDIR', ROOT_DIR.'model'.DS ); 
define('L2J', ROOT_DIR.'l2j'.DS );      
define('DBN', '####' );     
define('USR', '####' );
define('PWD','####');

use Doctrince\ORM\Tools\Setup;
use Doctrince\ORM\EntityManager;

$paths = array("/path/to/entity-files");
$isDevMode = false;

// the connection configuration
$dbParams = array(
    'driver'   => 'pdo_mysql',
    'user'     => USR,
    'password' => PWD,
    'dbname'   => DBN,
);

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);

/*function exceptionHandler($exception){
    error_log($exception->getMessage());
} 

set_error_handler("exceptionHandler");*/
?>

I checked many times to be sure that Doctrince\ORM\Tools\Setup.php is exist and also checked namespace Doctrince\ORM\Tools in setup.php existed. Yet i have still got error like this:

Fatal error: Class 'Doctrince\ORM\Tools\Setup' not found in /var/www/html/mysite.com/public_html/config.php on line 0

I really don't know why. the next line is still work even if i comment Doctrince\ORM\Tools\Setup. Please help. Thanks.

Haruji Burke
  • 449
  • 1
  • 4
  • 17

1 Answers1

0

I really don't know why.But i tried to download Doctrince again via Composer and the Composer.json i used :

{
    "require": {
       "Doctrine/ORM": "2.3.3"
    },
    "autoload": {
      "psr-0": {"MyProject\\Models\\": "src/models/"}
    }
}

and mySite is working smoothly. I got that json file from this link. Why can't we use only ORM and only ORM without anything like autoloading???

Community
  • 1
  • 1
Haruji Burke
  • 449
  • 1
  • 4
  • 17