mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 09:13:11 +08:00
Updated entity mappings so that schema an table prefixes can be eventually provided
This commit is contained in:
@@ -8,6 +8,8 @@ use Cake\Chronos\Chronos;
|
||||
use DateTimeInterface;
|
||||
use PUGX\Shortid\Factory as ShortIdFactory;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
function generateRandomShortCode(int $length = 5): string
|
||||
{
|
||||
static $shortIdFactory;
|
||||
@@ -39,3 +41,15 @@ function parseDateField($date): ?Chronos
|
||||
|
||||
return Chronos::parse($date);
|
||||
}
|
||||
|
||||
function determineTableName(string $tableName, array $emConfig = []): string
|
||||
{
|
||||
$schema = $emConfig['connection']['schema'] ?? null;
|
||||
// $tablePrefix = $emConfig['connection']['table_prefix'] ?? null; // TODO
|
||||
|
||||
if ($schema === null) {
|
||||
return $tableName;
|
||||
}
|
||||
|
||||
return sprintf('%s.%s', $schema, $tableName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user