remove db prefix

This commit is contained in:
Dennis Eichhorn 2020-03-12 18:03:50 +01:00
parent f5883de3e7
commit af161e8788
2 changed files with 5 additions and 6 deletions

View File

@ -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())

View File

@ -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();