bug fixes

This commit is contained in:
Dennis Eichhorn 2019-10-06 21:01:18 +02:00
parent 2862e30690
commit 5ec4ff9260

View File

@ -15,7 +15,9 @@ declare(strict_types=1);
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Module\InfoManager;
use phpOMS\Module\InstallerAbstract;
/**
@ -33,6 +35,8 @@ class Installer extends InstallerAbstract
*/
public static function install(DatabasePool $dbPool, InfoManager $info) : void
{
parent::install($dbPool, $info);
$sqlite = new SQLiteConnection([
'db' => 'sqlite',
'prefix' => '',
@ -45,14 +49,24 @@ class Installer extends InstallerAbstract
$sqlite->close();
}
private static function installCountries(SQLiteConnection $sqlite, DatabasePool $dbPool)
/**
* Install countries
*
* @param SQLiteConnection $sqlite SQLLite database connection of the source data
* @param DatabasePool $dbPool Database pool to save data to
*
* @return void
*
* @since 1.0.0
*/
private static function installCountries(SQLiteConnection $sqlite, DatabasePool $dbPool) : void
{
$con = $dbPool->get();
$query = new Builder($con);
$query->insert('country_name', 'country_native', 'country_code2', 'country_code3', 'country_codenum')->into('country');
$countries = $sqlite->select('*')->from('country')->execute();
$countries = $query->select('*')->from('country')->execute();
foreach ($countries as $country) {
$query->values(
$country['country_name'],
@ -66,14 +80,24 @@ class Installer extends InstallerAbstract
$con->execute($query->toSql());
}
private static function installLanguages(SQLiteConnection $sqlite, DatabasePool $dbPool)
/**
* Install languages
*
* @param SQLiteConnection $sqlite SQLLite database connection of the source data
* @param DatabasePool $dbPool Database pool to save data to
*
* @return void
*
* @since 1.0.0
*/
private static function installLanguages(SQLiteConnection $sqlite, DatabasePool $dbPool) : void
{
$con = $dbPool->get();
$query = new Builder($con);
$query->insert('language_name', 'language_native', 'language_639_2T', 'language_639_2B', 'language_639_3')->into('language');
$languages = $sqlite->select('*')->from('language')->execute();
$languages = $query->select('*')->from('language')->execute();
foreach ($languages as $language) {
$query->values(
$language['language_name'],