Skip to content

Commit

Permalink
Merge pull request #8 from ntidev/audit-log-repo-sort-by-fix
Browse files Browse the repository at this point in the history
Audit log repository sortBy fix
  • Loading branch information
bvisonl authored Jan 8, 2020
2 parents c528859 + 74cad8a commit 241a4bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataDog/AuditBundle/Repository/AuditLogRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function findByOptions($options = array()) {
$options = array(
"draw" => isset($options["draw"]) ? $options["draw"] : 1,
"search" => isset($options["search"]) ? $options["search"] : "",
"sortBy" => isset($options["sortBy"]) ? $options["sortBy"] : "a.loggedAt",
"sortBy" => isset($options["sortBy"]) ? $options["sortBy"] : "id",
"orderBy" => (isset($options["orderBy"]) && in_array(strtolower($options["orderBy"]), array("desc", "asc"))) ? $options["orderBy"] : "asc",
"start" => (isset($options["start"]) && $options["start"] >= 0) ? $options["start"] : 0,
"limit" => (isset($options["limit"]) && $options["limit"] < self::MAX_RESULTS) ? $options["limit"] : ( (isset($options["length"]) && $options["length"] < self::MAX_RESULTS) ? $options["length"] : self::MAX_RESULTS ),
Expand Down Expand Up @@ -124,7 +124,7 @@ public function findByOptions($options = array()) {
// Manage SortBy
if(is_array($options["sortBy"])) {
foreach($options["sortBy"] as $sort) {
$qb->addOrderBy($sort, $options["orderBy"]);
$qb->addOrderBy($sort, "a.".$options["orderBy"]);
}
} else {
$qb->orderBy($options["sortBy"], $options["orderBy"]);
Expand Down

0 comments on commit 241a4bb

Please sign in to comment.