added a side note
This commit is contained in:
parent
9cacf9ced9
commit
cbbfe45c1b
@ -1,27 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2022. Micha Espey <tracer@24unix.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Take care of the PDO object.
|
||||
*/
|
||||
class DatabaseConnection
|
||||
{
|
||||
private PDO $dbConnection;
|
||||
|
||||
// Currently no prefixes are used, but could be easily added to config.json.
|
||||
const TABLE_PREFIX = '';
|
||||
const TABLE_USERS = self::TABLE_PREFIX . "users";
|
||||
const TABLE_ADDRESSES = self::TABLE_PREFIX . "addresses";
|
||||
|
||||
public function __construct(private readonly Config $configController)
|
||||
public function __construct(private readonly Config $config)
|
||||
{
|
||||
$dbHost = $this->configController->getConfig(configKey: 'dbHost');
|
||||
$dbPort = $this->configController->getConfig(configKey: 'dbPort');
|
||||
$dbDatabase = $this->configController->getConfig(configKey: 'dbDatabase');
|
||||
$dbUser = $this->configController->getConfig(configKey: 'dbUser');
|
||||
$dbPassword = $this->configController->getConfig(configKey: 'dbPassword');
|
||||
$dbHost = $this->config->getConfig(configKey: 'dbHost');
|
||||
$dbPort = $this->config->getConfig(configKey: 'dbPort');
|
||||
$dbDatabase = $this->config->getConfig(configKey: 'dbDatabase');
|
||||
$dbUser = $this->config->getConfig(configKey: 'dbUser');
|
||||
$dbPassword = $this->config->getConfig(configKey: 'dbPassword');
|
||||
|
||||
$this->dbConnection = new PDO(
|
||||
dsn: "mysql:host=$dbHost;port=$dbPort;charset=utf8mb4;dbname=$dbDatabase",
|
||||
|
Loading…
Reference in New Issue
Block a user