mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-13 19:18:41 +00:00
bug fixes
This commit is contained in:
parent
2862e30690
commit
5ec4ff9260
|
|
@ -15,7 +15,9 @@ declare(strict_types=1);
|
||||||
namespace Modules\Admin\Admin;
|
namespace Modules\Admin\Admin;
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
|
use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,6 +35,8 @@ class Installer extends InstallerAbstract
|
||||||
*/
|
*/
|
||||||
public static function install(DatabasePool $dbPool, InfoManager $info) : void
|
public static function install(DatabasePool $dbPool, InfoManager $info) : void
|
||||||
{
|
{
|
||||||
|
parent::install($dbPool, $info);
|
||||||
|
|
||||||
$sqlite = new SQLiteConnection([
|
$sqlite = new SQLiteConnection([
|
||||||
'db' => 'sqlite',
|
'db' => 'sqlite',
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
|
|
@ -45,14 +49,24 @@ class Installer extends InstallerAbstract
|
||||||
$sqlite->close();
|
$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();
|
$con = $dbPool->get();
|
||||||
|
|
||||||
$query = new Builder($con);
|
$query = new Builder($con);
|
||||||
$query->insert('country_name', 'country_native', 'country_code2', 'country_code3', 'country_codenum')->into('country');
|
$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) {
|
foreach ($countries as $country) {
|
||||||
$query->values(
|
$query->values(
|
||||||
$country['country_name'],
|
$country['country_name'],
|
||||||
|
|
@ -66,14 +80,24 @@ class Installer extends InstallerAbstract
|
||||||
$con->execute($query->toSql());
|
$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();
|
$con = $dbPool->get();
|
||||||
|
|
||||||
$query = new Builder($con);
|
$query = new Builder($con);
|
||||||
$query->insert('language_name', 'language_native', 'language_639_2T', 'language_639_2B', 'language_639_3')->into('language');
|
$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) {
|
foreach ($languages as $language) {
|
||||||
$query->values(
|
$query->values(
|
||||||
$language['language_name'],
|
$language['language_name'],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user