浏览代码

Correctif sortable with tree

packProduct
Fab 3 年前
父节点
当前提交
84b5cb8367
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. +14
    -1
      Field/AssociationField.php

+ 14
- 1
Field/AssociationField.php 查看文件

@@ -78,6 +78,15 @@ final class AssociationField implements FieldInterface
return $this;
}


public function addOrderBy($field, $direction ='ASC') : self
{
$this->queryBuilderParameters['orderBy'][] = $field;
$this->queryBuilderParameters['orderByDirection'][] = $direction;

return $this;
}

public function initQueryBuilder(): self
{
$param = $this->queryBuilderParameters;
@@ -96,7 +105,11 @@ final class AssociationField implements FieldInterface
$qb->andWhere('e.status = :status')->setParameter('status', $param['status']);
}

$qb->orderBy('e.position', 'ASC');
if (isset($param['orderBy'])) {
foreach ($param['orderBy'] as $i=>$field) {
$qb->addOrderBy('e.'.$param['orderBy'][$i], $param['orderByDirection'][$i]);
}
}

/*if (isset($param['devAlias'])) {
$qb->andWhere('e.devAlias = :devAlias')->setParameter(

正在加载...
取消
保存