2017 © Pedro Peláez
 

simplesamlphp-module simplesamlphp-module-dbal

A SimpleSAMLphp module adding support for Doctrine/DBAL.

image

sgomez/simplesamlphp-module-dbal

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  • Saturday, March 3, 2018
  • by decano
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,749 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 30 % Grown

The README.md

SimpleSAMLphp Composer Doctrine/DBAL module

This package add a new datastore with Doctrine/DBAL library through a SimpleSAMLphp module installable through Composer. Installation can be as easy as executing:, (*1)

composer require sgomez/simplesamlphp-module-dbal ~1.0 # for SSP >= 1.14
composer require sgomez/simplesamlphp-module-dbal ~2.0 # for SSP >= 2.0|master

Configuring

You need to specify the next store.type on your config file:, (*2)

```[php] 'store.type' => 'SimpleSAML\Modules\DBAL\Store\DBAL',, (*3)


And copy the template config file from `modules/dbal/config-templates/module_dbal.php` to your config base directory. You must edit it with your database connection configuration. This module supports the same engines than _Doctrine/DBAL_. See [Doctrine DBAL configuration](http://doctrine-dbal.readthedocs.org/en/latest/reference/configuration.html) for the syntax. ```[php] $config = array ( 'store.dbal.url' => 'mysql://user:password@localhost:3306/simplesamlphp?charset=utf8mb4&serverVersion=5.7', // 'store.dbal.url' => 'sqlite:///simplesamlphp.sqlite', );

If you want to clean old keys automatically, remember to enable and configure the cron module., (*4)

Creating the Schema

The schema is not created every time than Store is called (like SQL store). You need to created it manually. You need to run this every time you install or update a module than use DBAL Store:, (*5)

[bash] bash$ vendor/bin/dbalschema, (*6)

Creating new schemas

If you want to create your own schema to your module, you need to create a hook_dbal.php file on your hooks directory. This file will run every time than dbalschema is launched., (*7)

This is a template:, (*8)

```[php] <?php, (*9)

function modulename_hook_dbal(&$dbinfo) { $store = SimpleSAML_Store::getInstance();, (*10)

if (! $store instanceof \SimpleSAML\Modules\DBAL\Store\DBAL ) {
    throw new \SimpleSAML_Error_Exception('OAuth2 module: Only DBAL Store is supported');
}

$schema = new \Doctrine\DBAL\Schema\Schema();

$fooTable = $store->getPrefix().'_foo';
$foo = $schema->createTable($fooTable);
$foo->addColumn('id', 'string', [ 'length' => 255 ]);
$foo->addColumn('name', 'string', [ 'length' => 255 ]);
$foo->setPrimaryKey(['id']);

$barTable = $store->getPrefix().'_bar';
$bar = $schema->createTable($barTable);
$bar->addColumn('id', 'string', [ 'length' => 255 ]);
$bar->addColumn('expires_at', 'datetime');
$bar->addColumn('foo_id', 'string', [ 'length' => 255 ]);
$bar->setPrimaryKey(['id']);
$bar->addForeignKeyConstraint($foo, ['foo_id'], ['id'], ['onDelete' => 'CASCADE']);

$store->createOrUpdateSchema($schema, $store->getPrefix().'_modulename');

$dbinfo['summary'][] = 'Created ModuleName Schema';

}, (*11)

```, (*12)

Doctrine DBAL is able to update your schema in almost any case without drop it. To know all types and options see Doctrine DBAL Documentation., (*13)

The Versions

03/03 2018

1.0.x-dev

1.0.9999999.9999999-dev

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

03/03 2018

1.0.5

1.0.5.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

13/06 2017

dev-master

9999999-dev

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

13/06 2017

2.0.x-dev

2.0.9999999.9999999-dev

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

13/06 2017

2.0.3

2.0.3.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

13/06 2017

1.0.4

1.0.4.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

04/04 2017

2.0.2

2.0.2.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

04/04 2017

1.0.3

1.0.3.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

04/04 2017

1.0.2

1.0.2.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

04/04 2017

2.0.1

2.0.1.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

04/04 2017

1.0.1

1.0.1.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

doctrine dbal

18/08 2016

v1.0.0

1.0.0.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

doctrine dbal

18/08 2016

2.0.0

2.0.0.0

A SimpleSAMLphp module adding support for Doctrine/DBAL.

  Sources   Download

GPL-3.0

The Requires

 

doctrine dbal