protected function setUp()
 {
     $params = array('driver' => 'pdo_mysql', 'host' => 'localhost', 'user' => 'root', 'password' => 'testmachine', 'dbname' => 'v_products_tests');
     $workspace = 'default';
     $user = '******';
     $pass = '******';
     $dbConn = \Doctrine\DBAL\DriverManager::getConnection($params);
     $parameters = array('jackalope.doctrine_dbal_connection' => $dbConn);
     /**
             $schema = RepositorySchema::create();
             foreach ($schema->toSql($dbConn->getDatabasePlatform()) as $sql) {
                 $dbConn->exec($sql);
             } */
     $repositoryFactory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
     $repository = $repositoryFactory->getRepository($parameters);
     $credentials = new \PHPCR\SimpleCredentials(null, null);
     $session = $repository->login($credentials, $workspace);
     $locatorXml = new SymfonyFileLocator(array(__DIR__ . '/../../../lib/Vespolina/Product/Mapping' => 'Vespolina\\Entity\\Product', __DIR__ . '/../../../vendor/vespolina/pricing/lib/Vespolina/Pricing/Mapping' => 'Vespolina\\Entity\\Pricing', __DIR__ . '/../../../vendor/vespolina/taxonomy/lib/Vespolina/Taxonomy/Mapping' => 'Vespolina\\Entity\\Taxonomy'), '.phpcr.xml');
     $xmlDriver = new XmlDriver($locatorXml);
     $config = new \Doctrine\ODM\PHPCR\Configuration();
     $config->setMetadataDriverImpl($xmlDriver);
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setAutoGenerateProxyClasses(true);
     $documentManager = \Doctrine\ODM\PHPCR\DocumentManager::create($session, $config);
     $this->productGateway = new ProductDoctrinePHPCRGateway($documentManager, 'Vespolina\\Entity\\Product\\Product');
     $this->taxonomyGateway = new TaxonomyPHPCRGateway($documentManager, 'Vespolina\\Entity\\Taxonomy\\TaxonomyNode', '/');
     $this->taxonomyRootNode = $documentManager->find(null, '/');
     parent::setUp();
 }
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('JackalopeRepository', function ($app) {
         $driver = 'pdo_sqlite';
         // pdo_pgsql | pdo_sqlite
         $host = 'localhost';
         $user = '******';
         $pass = '';
         $database = 'jackalope';
         $path = '/tmp/phpcr.sqlite';
         // for SQLite
         $workspace = 'default';
         // Bootstrap Doctrine
         $dbConn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $pass, 'dbname' => $database, 'path' => $path));
         $factory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
         $repository = $factory->getRepository(array('jackalope.doctrine_dbal_connection' => $dbConn));
         return $repository;
     });
     //
 }
<?php

/*
 * This file is part of the PHPCR Shell package
 *
 * (c) Daniel Leech <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */
$dbConn = \Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_sqlite', 'dbname' => 'test', 'path' => __DIR__ . '/app.sqlite']);
/*
 * configuration
 */
$workspace = 'default';
// phpcr workspace to use
$user = '******';
$pass = '******';
$factory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
$repository = $factory->getRepository(['jackalope.doctrine_dbal_connection' => $dbConn]);
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
/* only create a session if this is not about the server control command */
if (isset($argv[1]) && $argv[1] != 'jackalope:init:dbal' && $argv[1] != 'list' && $argv[1] != 'help') {
    $session = $repository->login($credentials, $workspace);
    $helperSet = new \Symfony\Component\Console\Helper\HelperSet(['dialog' => new \Symfony\Component\Console\Helper\DialogHelper(), 'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session), 'phpcr_console_dumper' => new \PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper()]);
} elseif (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
    // special case: the init command needs the db connection, but a session is impossible if the db is not yet initialized
    $helperSet = new \Symfony\Component\Console\Helper\HelperSet(['connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn)]);
}
<?php

$dbConn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'dbname' => 'test', 'path' => __DIR__ . '/app.sqlite'));
/*
 * configuration
 */
$workspace = 'default';
// phpcr workspace to use
$user = '******';
$pass = '******';
$factory = new \Jackalope\RepositoryFactoryDoctrineDBAL();
$repository = $factory->getRepository(array('jackalope.doctrine_dbal_connection' => $dbConn));
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
/* only create a session if this is not about the server control command */
if (isset($argv[1]) && $argv[1] != 'jackalope:init:dbal' && $argv[1] != 'list' && $argv[1] != 'help') {
    $session = $repository->login($credentials, $workspace);
    $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('dialog' => new \Symfony\Component\Console\Helper\DialogHelper(), 'phpcr' => new \PHPCR\Util\Console\Helper\PhpcrHelper($session), 'phpcr_console_dumper' => new \PHPCR\Util\Console\Helper\PhpcrConsoleDumperHelper()));
} else {
    if (isset($argv[1]) && $argv[1] == 'jackalope:init:dbal') {
        // special case: the init command needs the db connection, but a session is impossible if the db is not yet initialized
        $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('connection' => new \Jackalope\Tools\Console\Helper\DoctrineDbalHelper($dbConn)));
    }
}