-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
61 lines (53 loc) · 1.24 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Created by PhpStorm.
* User: johns
* Date: 2016/5/21
* Time: 14:12
*/
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once dirname(__FILE__).'/'."vendor/autoload.php";
$isDevMode=false;
//$paths=array("/path/to/entity-files");
$paths=array(
__DIR__."/src",
__DIR__."/DataAccess"
);
$config=Setup::createAnnotationMetadataConfiguration($paths,$isDevMode);
//$dbParams=array(
// 'driver'=>'pdo_mysql',
// 'user'=>'root',
// 'password'=>'123456',
// 'dbname'=>'j133'
//);
$dbParams=array(
'host'=>'rds76ac7pi0a1ow5ionlo.mysql.rds.aliyuncs.com',
'driver'=>'pdo_mysql',
'user'=>'j133_10131701',
'password'=>'j133_10131701',
'dbname'=>'j133'
);
/**
* @return EntityManager
* @throws \Doctrine\ORM\ORMException
*/
function getEM()
{
$isDevMode=false;
//$paths=array("/path/to/entity-files");
$paths=array(
__DIR__."/src",
__DIR__."/DataAccess"
);
$config=Setup::createAnnotationMetadataConfiguration($paths,$isDevMode);
$dbParams=array(
'host'=>'rds76ac7pi0a1ow5ionlo.mysql.rds.aliyuncs.com',
'driver'=>'pdo_mysql',
'user'=>'j133_10131701',
'password'=>'j133_10131701',
'dbname'=>'j133'
);
return EntityManager::create($dbParams, $config);
}
$entityManager=EntityManager::create($dbParams, $config);