diff options
author | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-06-28 21:30:11 +0300 |
---|---|---|
committer | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-06-28 21:30:14 +0300 |
commit | a257855e07ec81b580f401da65f17420d099fafd (patch) | |
tree | 5bdffea4e950ec42bea76c6f1466aa7a10c071b2 /lib/Platform | |
parent | ecb04a331b5196bde44a74212925326ff1a92075 (diff) |
autocomplete for columns
Diffstat (limited to 'lib/Platform')
-rw-r--r-- | lib/Platform/AbstractPlatform.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Platform/AbstractPlatform.php b/lib/Platform/AbstractPlatform.php index 38d8f61..59052d4 100644 --- a/lib/Platform/AbstractPlatform.php +++ b/lib/Platform/AbstractPlatform.php @@ -108,12 +108,13 @@ abstract class AbstractPlatform /** * Get all the columns defined in the table. * - * @param string $table The table name. + * @param string $table The table name. + * @param string $phrase Show only columns containing given phrase. * * @return array Array with column names. * @throws DBALException On a database exception. */ - public function getColumns($table) + public function getColumns($table, $phrase = "") { $platform = $this->connection->getDatabasePlatform(); $query = $platform->getListTableColumnsSQL($table); @@ -123,7 +124,9 @@ abstract class AbstractPlatform while ($row = $result->fetch()) { $name = $this->getColumnName($row); - $columns[] = $name; + if (preg_match("/.*$phrase.*/i", $name)) { + $columns[] = $name; + } } return $columns; |