Commit 4583bf08 authored by Tino Goratsch's avatar Tino Goratsch

minor optimization

parent 7fb0243b
......@@ -24,14 +24,14 @@ class DataGridRepository extends AbstractRepository
{
$queryBuilder = $this->db->getConnection()->createQueryBuilder();
$queryBuilder
->select($this->getColumns(clone $columns))
->select($this->getColumns($columns))
->from($this->getTableName(), 'main')
->setParameters($this->getParameters());
$this->addJoin($queryBuilder);
$this->addWhere($queryBuilder);
$this->addGroupBy($queryBuilder);
$this->setOrderBy(clone $columns, $queryBuilder);
$this->setOrderBy($columns, $queryBuilder);
return $queryBuilder->execute()->fetchAll();
}
......@@ -44,7 +44,7 @@ class DataGridRepository extends AbstractRepository
protected function getColumns(ColumnPriorityQueue $gridColumns)
{
$columnsToSelect = [];
foreach ($gridColumns as $column) {
foreach (clone $gridColumns as $column) {
if (!empty($column['fields'])) {
if (!is_array($column['fields'])) {
$column['fields'] = [$column['fields']];
......@@ -94,7 +94,7 @@ class DataGridRepository extends AbstractRepository
*/
protected function setOrderBy(ColumnPriorityQueue $gridColumns, QueryBuilder $queryBuilder)
{
foreach ($gridColumns as $gridColumn) {
foreach (clone $gridColumns as $gridColumn) {
if ($gridColumn['default_sort'] === true) {
if (!is_array($gridColumn['fields'])) {
$gridColumn['fields'] = [$gridColumn['fields']];
......
......@@ -9,4 +9,4 @@ define('ACP3_ROOT_DIR', realpath(__DIR__) . '/');
require './vendor/autoload.php';
(new \ACP3\Core\Application\Bootstrap())->run();
\ No newline at end of file
(new \ACP3\Core\Application\Bootstrap())->run();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment