From f0eade1781983e9afa8570fc00865613c0ed0e03 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 12 Mar 2020 18:03:50 +0100 Subject: [PATCH] remove db prefix --- Admin/Installer.php | 10 +++------- Models/AccountMapper.php | 3 +-- Models/AddressMapper.php | 6 ------ Models/LocalizationMapper.php | 5 ++--- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index 031485b..ce788ad 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -40,7 +40,6 @@ final class Installer extends InstallerAbstract $sqlite = new SQLiteConnection([ 'db' => 'sqlite', - 'prefix' => '', 'database' => __DIR__ . '/../../../phpOMS/Localization/Defaults/localization.sqlite', ]); @@ -66,8 +65,7 @@ final class Installer extends InstallerAbstract $con = $dbPool->get(); $query = new Builder($con); - $query->prefix($con->getPrefix()) - ->insert('country_name', 'country_code2', 'country_code3', 'country_numeric') + $query->insert('country_name', 'country_code2', 'country_code3', 'country_numeric') ->into('country'); $querySqlite = new Builder($sqlite); @@ -100,8 +98,7 @@ final class Installer extends InstallerAbstract $con = $dbPool->get(); $query = new Builder($con); - $query->prefix($con->getPrefix()) - ->insert('language_name', 'language_native', 'language_639_1', 'language_639_2T', 'language_639_2B', 'language_639_3') + $query->insert('language_name', 'language_native', 'language_639_1', 'language_639_2T', 'language_639_2B', 'language_639_3') ->into('language'); $querySqlite = new Builder($sqlite); @@ -136,8 +133,7 @@ final class Installer extends InstallerAbstract $con = $dbPool->get(); $query = new Builder($con); - $query->prefix($con->getPrefix()) - ->insert('currency_id', 'currency_name', 'currency_code', 'currency_number', 'currency_symbol', 'currency_subunits', 'currency_decimal', 'currency_countries') + $query->insert('currency_id', 'currency_name', 'currency_code', 'currency_number', 'currency_symbol', 'currency_subunits', 'currency_decimal', 'currency_countries') ->into('currency'); $querySqlite = new Builder($sqlite); diff --git a/Models/AccountMapper.php b/Models/AccountMapper.php index b89f12b..a6c9acc 100644 --- a/Models/AccountMapper.php +++ b/Models/AccountMapper.php @@ -158,8 +158,7 @@ final class AccountMapper extends DataMapperAbstract $result = null; $query = new Builder(self::$db); - $result = $query->prefix(self::$db->getPrefix()) - ->select('account_id', 'account_login', 'account_password', 'account_password_temp', 'account_tries') + $result = $query->select('account_id', 'account_login', 'account_password', 'account_password_temp', 'account_tries') ->from('account') ->where('account_login', '=', $login) ->execute()->fetchAll(); diff --git a/Models/AddressMapper.php b/Models/AddressMapper.php index 1335837..3ab59ed 100644 --- a/Models/AddressMapper.php +++ b/Models/AddressMapper.php @@ -45,18 +45,12 @@ final class AddressMapper extends DataMapperAbstract /** * Has one relation. * - * @todo Orange-Management/phpOMS#224 - * Implement composite models. - * If a column is defined only that column value should get populated in the model and not the full model! - * OwnsOne, HasOne, use single value instead of full model defined in the mapper. - * * @var array * @since 1.0.0 */ protected static array $ownsOne = [ 'country' => [ 'mapper' => CountryMapper::class, - //'column' => '', 'self' => 'address_country', ], ]; diff --git a/Models/LocalizationMapper.php b/Models/LocalizationMapper.php index a695f52..8375cee 100644 --- a/Models/LocalizationMapper.php +++ b/Models/LocalizationMapper.php @@ -145,15 +145,14 @@ final class LocalizationMapper extends DataMapperAbstract * * @param mixed $primaryKey Key * @param int $relations Load relations - * @param mixed $fill Object to fill * @param int $depth Relation depth * * @return mixed * * @since 1.0.0 */ - public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null, int $depth = 1) + public static function get($primaryKey, int $relations = RelationType::ALL, int $depth = 1) { - return parent::get($primaryKey, $relations, $fill, 1); + return parent::get($primaryKey, $relations, 1); } }