fix getTableNamesWithoutPrefix()

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2021-05-26 13:08:34 -01:00
parent 333665b43d
commit 52080c92e5
1 changed files with 11 additions and 5 deletions

View File

@ -59,15 +59,14 @@ class SchemaWrapper implements ISchemaWrapper {
*
* @return array
*/
public function getTableNamesWithoutPrefix() {
$tableNames = $this->schema->getTableNames();
public function getTableNamesWithoutPrefix(): array {
return array_map(function ($tableName) {
if (strpos($tableName, $this->connection->getPrefix()) === 0) {
return substr($tableName, strlen($this->connection->getPrefix()));
}
return $tableName;
}, $tableNames);
}, $this->getTableNames());
}
// Overwritten methods
@ -75,8 +74,15 @@ class SchemaWrapper implements ISchemaWrapper {
/**
* @return array
*/
public function getTableNames() {
return $this->schema->getTableNames();
public function getTableNames(): array {
return array_map(function (string $fullName) {
$pos = strpos($fullName, '.');
if ($pos === false) {
return $fullName;
}
return substr($fullName, $pos+1);
}, $this->schema->getTableNames());
}
/**