autocomplete for columns
This commit is contained in:
@@ -315,7 +315,8 @@ class SettingsController extends Controller
|
||||
$connection = $this->getConnection();
|
||||
$platform = PlatformFactory::getPlatform($connection);
|
||||
$columns = $platform->getColumns(
|
||||
$this->request->getParam($table)
|
||||
$this->request->getParam($table),
|
||||
$this->request->getParam("input")
|
||||
);
|
||||
|
||||
return $columns;
|
||||
|
||||
@@ -109,11 +109,12 @@ abstract class AbstractPlatform
|
||||
* Get all the columns defined in the table.
|
||||
*
|
||||
* @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,8 +124,10 @@ abstract class AbstractPlatform
|
||||
|
||||
while ($row = $result->fetch()) {
|
||||
$name = $this->getColumnName($row);
|
||||
if (preg_match("/.*$phrase.*/i", $name)) {
|
||||
$columns[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user