autocomplete for columns
This commit is contained in:
@@ -315,7 +315,8 @@ class SettingsController extends Controller
|
|||||||
$connection = $this->getConnection();
|
$connection = $this->getConnection();
|
||||||
$platform = PlatformFactory::getPlatform($connection);
|
$platform = PlatformFactory::getPlatform($connection);
|
||||||
$columns = $platform->getColumns(
|
$columns = $platform->getColumns(
|
||||||
$this->request->getParam($table)
|
$this->request->getParam($table),
|
||||||
|
$this->request->getParam("input")
|
||||||
);
|
);
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
|
|||||||
@@ -108,12 +108,13 @@ abstract class AbstractPlatform
|
|||||||
/**
|
/**
|
||||||
* Get all the columns defined in the table.
|
* 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.
|
* @return array Array with column names.
|
||||||
* @throws DBALException On a database exception.
|
* @throws DBALException On a database exception.
|
||||||
*/
|
*/
|
||||||
public function getColumns($table)
|
public function getColumns($table, $phrase = "")
|
||||||
{
|
{
|
||||||
$platform = $this->connection->getDatabasePlatform();
|
$platform = $this->connection->getDatabasePlatform();
|
||||||
$query = $platform->getListTableColumnsSQL($table);
|
$query = $platform->getListTableColumnsSQL($table);
|
||||||
@@ -123,7 +124,9 @@ abstract class AbstractPlatform
|
|||||||
|
|
||||||
while ($row = $result->fetch()) {
|
while ($row = $result->fetch()) {
|
||||||
$name = $this->getColumnName($row);
|
$name = $this->getColumnName($row);
|
||||||
$columns[] = $name;
|
if (preg_match("/.*$phrase.*/i", $name)) {
|
||||||
|
$columns[] = $name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
|
|||||||
Reference in New Issue
Block a user