diff options
author | polo-pc-greta <ordipolo@gmx.fr> | 2025-03-27 10:13:03 +0100 |
---|---|---|
committer | polo-pc-greta <ordipolo@gmx.fr> | 2025-03-27 10:13:03 +0100 |
commit | df3612ed7e6691530503f79483d2fdbc032d01b8 (patch) | |
tree | 56d1c68fdc8625f5dad1937a654299d45142c79a /src/model/doctrine-bootstrap.php | |
download | cms-df3612ed7e6691530503f79483d2fdbc032d01b8.zip |
mise en ligne github
Diffstat (limited to 'src/model/doctrine-bootstrap.php')
-rw-r--r-- | src/model/doctrine-bootstrap.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/model/doctrine-bootstrap.php b/src/model/doctrine-bootstrap.php new file mode 100644 index 0000000..139f410 --- /dev/null +++ b/src/model/doctrine-bootstrap.php | |||
@@ -0,0 +1,31 @@ | |||
1 | <?php | ||
2 | // src/model/doctrine-bootstrap.php | ||
3 | |||
4 | use Doctrine\ORM\ORMSetup; | ||
5 | use Doctrine\DBAL\DriverManager; | ||
6 | use Doctrine\ORM\EntityManager; | ||
7 | |||
8 | require_once "../vendor/autoload.php"; | ||
9 | |||
10 | // Create a simple "default" Doctrine ORM configuration for Attributes | ||
11 | $config = ORMSetup::createAttributeMetadataConfiguration( | ||
12 | //paths: array(__DIR__.'/entities'), | ||
13 | paths: array('../src/model/entities'), | ||
14 | isDevMode: true, | ||
15 | // true: cache en mémoire vive | ||
16 | // false: utilisation de APCu ou redis ou memcache | ||
17 | ); | ||
18 | |||
19 | // configuring the database connection | ||
20 | $connection = DriverManager::getConnection([ | ||
21 | 'driver' => Config::$db_driver, | ||
22 | 'user' => Config::$user, | ||
23 | 'password' => Config::$password, | ||
24 | 'host' => Config::$db_host, | ||
25 | 'dbname' => Config::$database, | ||
26 | ], $config); | ||
27 | |||
28 | // obtaining the entity manager | ||
29 | $entityManager = new EntityManager($connection, $config); | ||
30 | |||
31 | foreach($entityManager->getMetadataFactory()->getAllMetadata() as $class){} \ No newline at end of file | ||