瀏覽代碼

AbstractRepositoryQuery : ajout setOrderBy()

feature/symfony6.1
Guillaume Bourgeois 1 年之前
父節點
當前提交
0b2448b3d8
共有 1 個檔案被更改,包括 6 行新增1 行删除
  1. +6
    -1
      Repository/AbstractRepositoryQuery.php

+ 6
- 1
Repository/AbstractRepositoryQuery.php 查看文件

@@ -131,7 +131,6 @@ abstract class AbstractRepositoryQuery implements RepositoryQueryInterface
return $this;
}*/

// @TODO : créer un addOrderBy et un orderBy
public function orderBy(string $field, string $sort = 'ASC'): self
{
if (strpos($field, '.')!==false) {
@@ -141,6 +140,12 @@ abstract class AbstractRepositoryQuery implements RepositoryQueryInterface
}
}

public function setOrderBy(string $field, string $sort = 'ASC'): self
{
$this->resetDQLParts(['orderBy']);
return $this->orderBy($field, $sort);
}

public function filterById(int $id):self
{
return $this

Loading…
取消
儲存