forked from doctrine/phpcr-odm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli-config.midgard_sqlite.php.dist
35 lines (28 loc) · 1.22 KB
/
cli-config.midgard_sqlite.php.dist
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
<?php
/**
* The config file is responsible to make class loading work and initialize a
* DocumentManagerHelper that contains the doctrine document manager with a
* Session of your phcpr implementation.
* The array $extraCommands can be used to inject implementation specific commands.
* Add instances of commands for eventual implementation specific commands to this array.
*/
$extraCommands = array();
$params = array(
'midgard2.configuration.db.type' => 'SQLite',
'midgard2.configuration.db.name' => 'odm',
'midgard2.configuration.db.dir' => '/tmp',
'midgard2.configuration.db.init' => true,
'midgard2.configuration.blobdir' => '/tmp/blobs'
);
$workspace = '';
$user = 'admin';
$pass = 'password';
$repository = \Midgard\PHPCR\RepositoryFactory::getRepository($params);
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
$session = $repository->login($credentials, $workspace);
/* prepare the doctrine configuration */
$config = new \Doctrine\ODM\PHPCR\Configuration();
$dm = \Doctrine\ODM\PHPCR\DocumentManager::create($session, $config);
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'dm' => new \Doctrine\ODM\PHPCR\Tools\Console\Helper\DocumentManagerHelper(null, $dm)
));