Skip to content

Commit 241a4bb

Browse files
authored
Merge pull request #8 from ntidev/audit-log-repo-sort-by-fix
Audit log repository sortBy fix
2 parents c528859 + 74cad8a commit 241a4bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DataDog/AuditBundle/Repository/AuditLogRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function findByOptions($options = array()) {
2929
$options = array(
3030
"draw" => isset($options["draw"]) ? $options["draw"] : 1,
3131
"search" => isset($options["search"]) ? $options["search"] : "",
32-
"sortBy" => isset($options["sortBy"]) ? $options["sortBy"] : "a.loggedAt",
32+
"sortBy" => isset($options["sortBy"]) ? $options["sortBy"] : "id",
3333
"orderBy" => (isset($options["orderBy"]) && in_array(strtolower($options["orderBy"]), array("desc", "asc"))) ? $options["orderBy"] : "asc",
3434
"start" => (isset($options["start"]) && $options["start"] >= 0) ? $options["start"] : 0,
3535
"limit" => (isset($options["limit"]) && $options["limit"] < self::MAX_RESULTS) ? $options["limit"] : ( (isset($options["length"]) && $options["length"] < self::MAX_RESULTS) ? $options["length"] : self::MAX_RESULTS ),
@@ -124,7 +124,7 @@ public function findByOptions($options = array()) {
124124
// Manage SortBy
125125
if(is_array($options["sortBy"])) {
126126
foreach($options["sortBy"] as $sort) {
127-
$qb->addOrderBy($sort, $options["orderBy"]);
127+
$qb->addOrderBy($sort, "a.".$options["orderBy"]);
128128
}
129129
} else {
130130
$qb->orderBy($options["sortBy"], $options["orderBy"]);

0 commit comments

Comments
 (0)