2017 © Pedro Peláez
 

library database

image

xervice/database

  • Tuesday, July 31, 2018
  • by mibexx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 112 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 1767 % Grown

The README.md

Scrutinizer Code Quality Code Coverage, (*1)

Default configuration, (*2)

<?php

use Xervice\Database\DatabaseConfig;

$config[DatabaseConfig::PROPEL_CONF_DIR] = __DIR__;


$config[DatabaseConfig::PROPEL_CONF_ADAPTER] = 'pgsql';

$config[DatabaseConfig::PROPEL_CONF_HOST] = '127.0.0.1';
$config[DatabaseConfig::PROPEL_CONF_PORT] = '5432';
$config[DatabaseConfig::PROPEL_CONF_DBNAME] = '';
$config[DatabaseConfig::PROPEL_CONF_USER] = '';
$config[DatabaseConfig::PROPEL_CONF_PASSWORD] = '';


$dsn = sprintf(
    '%s:host=%s;port=%d;dbname=%s;user=%s;password=%s',
    $config[DatabaseConfig::PROPEL_CONF_ADAPTER],
    $config[DatabaseConfig::PROPEL_CONF_HOST] ,
    $config[DatabaseConfig::PROPEL_CONF_PORT],
    $config[DatabaseConfig::PROPEL_CONF_DBNAME],
    $config[DatabaseConfig::PROPEL_CONF_USER],
    $config[DatabaseConfig::PROPEL_CONF_PASSWORD]
);

$config[DatabaseConfig::PROPEL] = [
    'propel' => [
        'database'  => [
            'connections' => [
                'default' => [
                    'adapter'    => $config[DatabaseConfig::PROPEL_CONF_ADAPTER],
                    'classname'  => 'Propel\Runtime\Connection\ConnectionWrapper',
                    'dsn'        => $dsn,
                    'user'       => $config[DatabaseConfig::PROPEL_CONF_USER],
                    'password'   => $config[DatabaseConfig::PROPEL_CONF_PASSWORD],
                    'attributes' => [
                        'ATTR_EMULATE_PREPARES' => false,
                        'ATTR_TIMEOUT'          => 30,
                    ]
                ]
            ],
        ],
        'runtime'   => [
            'defaultConnection' => 'default',
            'connections'       => ['default']
        ],
        'generator' => [
            'defaultConnection' => 'default',
            'connections'       => ['default'],
            'recursive'         => true
        ],
        'paths'     => [
            'projectDir'   => dirname(__DIR__),
            'schemaDir'    => dirname(__DIR__) . '/src',
            'outputDir'    => dirname(__DIR__) . '/src/Orm/Output',
            'phpDir'       => dirname(__DIR__) . '/src/',
            'migrationDir' => dirname(__DIR__) . '/src/Orm/Migrations',
            'phpConfDir'   => dirname(__DIR__) . '/src/Orm/Config',
            'sqlDir'       => dirname(__DIR__) . '/src/Orm/Sql'
        ]
    ]
];

If you want to use a query container class, you can add the DatabaseHelper to the core module helper list. After that you cann create a class "MyModuleQueryContainer" in your module root. The class must implement the QueryContainerInterface. You can add that class in your dependency provider by getting it from the locator., (*3)

The Versions

22/07 2018
15/07 2018

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

09/07 2018

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

06/07 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram