From af161e8788d2bb9a3f03e9cb51a88593a0e3a071 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 12 Mar 2020 18:03:50 +0100 Subject: [PATCH] remove db prefix --- Models/EmployeeMapper.php | 5 ++--- Models/StaffList.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Models/EmployeeMapper.php b/Models/EmployeeMapper.php index 22a92c9..f1358f9 100644 --- a/Models/EmployeeMapper.php +++ b/Models/EmployeeMapper.php @@ -64,7 +64,7 @@ final class EmployeeMapper extends DataMapperAbstract protected static array $hasMany = [ 'companyHistory' => [ 'mapper' => EmployeeHistoryMapper::class, - 'table' => 'hr_staff_history', + 'table' => 'hr_staff_history', // @todo: is this requried? This is stored in the mapper already. In other places I'm not using this, either use it everywhere or nowhere. Using the mapper is slower but protects us from table name changes! 'external' => 'hr_staff_history_staff', 'self' => null, ], @@ -98,8 +98,7 @@ final class EmployeeMapper extends DataMapperAbstract public static function getFromAccount(int $account) : Employee { $query = new Builder(self::$db); - $query->prefix(self::$db->getPrefix()) - ->select(self::$table . '.*') + $query->select(self::$table . '.*') ->from(self::$table) ->innerJoin(ProfileMapper::getTable()) ->on(self::$table . '.hr_staff_profile', '=', ProfileMapper::getTable() . '.' . ProfileMapper::getPrimaryField()) diff --git a/Models/StaffList.php b/Models/StaffList.php index 8ccdc29..304f7fc 100644 --- a/Models/StaffList.php +++ b/Models/StaffList.php @@ -68,10 +68,10 @@ class StaffList $search = $this->dbPool->get()->generate_sql_filter($filter, true); $sth = $this->dbPool->get()->con->prepare('SELECT - `' . $this->dbPool->get()->prefix . 'hr_staff`.* + `hr_staff`.* FROM - `' . $this->dbPool->get()->prefix . 'hr_staff` ' - . $search . 'LIMIT ' . $offset . ',' . $limit); + `hr_staff` ' + . $search . 'LIMIT ' . $offset . ',' . $limit); $sth->execute(); $result['list'] = $sth->fetchAll();