This commit is contained in:
2019-09-13 17:32:33 -03:00
parent 52fcfdaf6d
commit 7e565657f1

25
src/MySQLRequirements.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace Aldarien\Models;
use Aldarien\Common\Definition\DatabaseEngineRequirements as EngineRequirementsInterface;
class MySQLRequirements implements EngineRequirementsInterface {
public function dsnSpecs(): array {
return [
'host_name',
'host_port',
'database_name'
];
}
public function getDSN(object $config): string {
$dsn = 'mysql:host=' . $config->host->name;
if (isset($config->host->port)) {
$dsn .= ';port=' . $config->host->port;
}
$dsn .= '; dbname=' . $config->database->name;
return $dsn;
}
public function hasUser(): bool {
return true;
}
}