mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-07-31 13:20:11 +02:00
Implement methods 'makeTableName' and 'makeTableNameComponents'
This commit is contained in:
@@ -412,4 +412,45 @@ abstract class UserManager {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a (qualified) full table name from an optional qualifier, an optional prefix, and the table name itself
|
||||
*
|
||||
* The optional qualifier may be a database name or a schema name, for example
|
||||
*
|
||||
* @param string $name the name of the table
|
||||
* @return string[] the components of the (qualified) full name of the table
|
||||
*/
|
||||
protected function makeTableNameComponents($name) {
|
||||
$components = [];
|
||||
|
||||
if (!empty($this->dbSchema)) {
|
||||
$components[] = $this->dbSchema;
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
if (!empty($this->dbTablePrefix)) {
|
||||
$components[] = $this->dbTablePrefix . $name;
|
||||
}
|
||||
else {
|
||||
$components[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a (qualified) full table name from an optional qualifier, an optional prefix, and the table name itself
|
||||
*
|
||||
* The optional qualifier may be a database name or a schema name, for example
|
||||
*
|
||||
* @param string $name the name of the table
|
||||
* @return string the (qualified) full name of the table
|
||||
*/
|
||||
protected function makeTableName($name) {
|
||||
$components = $this->makeTableNameComponents($name);
|
||||
|
||||
return \implode('.', $components);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user