mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Ajustments
Altered code to according to the feedback and added phpdoc.
This commit is contained in:
parent
29016645e5
commit
ee6b250a46
@ -73,18 +73,20 @@ class FulltextFilter extends SearchFilter {
|
||||
|
||||
return parent::getDbName();
|
||||
}
|
||||
|
||||
private function prepareColumns($columns) {
|
||||
$class = '';
|
||||
$parts = explode(',', $columns);
|
||||
array_walk($parts, function(&$col, $key) use (&$class) {
|
||||
$name = trim($col, " \t\n\r\0\x0B\"");
|
||||
if (empty($class)) {
|
||||
$class = ClassInfo::table_for_object_field($this->model, $name);
|
||||
}
|
||||
$col = sprintf('"%s"."%s"', $class, $name);
|
||||
});
|
||||
return implode(',', $parts);
|
||||
|
||||
/**
|
||||
* Adds table identifier to the every column.
|
||||
* Columns must have table identifier to prevent duplicate column name error.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function prepareColumns($columns) {
|
||||
$cols = preg_split('/"?\s*,\s*"?/', trim($columns, '(") '));
|
||||
$class = ClassInfo::table_for_object_field($this->model, current($cols));
|
||||
$cols = array_map(function($col) use ($class) {
|
||||
return sprintf('"%s"."%s"', $class, $col);
|
||||
}, $cols);
|
||||
return implode(',', $cols);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user