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