Skip to content

Commit

Permalink
Merge pull request #5 from Thibcabanes/feature/105983
Browse files Browse the repository at this point in the history
[FEATURE#105983] Warning demande et suppression de créneaux (provider)
  • Loading branch information
Kumatetsu authored Feb 26, 2019
2 parents cf7f8cb + d52cf92 commit 7efa16c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/ChangeRequestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function findByQueryString($query, $from = 0, $size = 99999, $sort = "")
function ($hit) {
$change_todos = new ChangeTodos();
$change_todos->fromArray($hit);

return $change_todos;
},
$response["hits"]
Expand All @@ -42,6 +43,30 @@ function ($hit) {
return $response;
}

public function findByQueryStringAndAggs($query, $from = 0, $size = 99999, $sort = "", $aggs = [])
{
$query = urlencode($query);
$body = [];

if (!empty($aggs)) {
$body = ["aggs" => $aggs];
}

$response = $this->fireRequest("POST", "/aggs?q={$query}&from={$from}&size={$size}&sort={$sort}", $body);

$response["hits"]["hits"] = array_map(
function ($hit) {
$change_todos = new ChangeTodos();
$change_todos->fromArray($hit);

return $change_todos;
},
$response["hits"]["hits"]
);

return $response;
}

public function findOneByQueryString($query)
{
$matching = $this->findByQueryString($query, 0, 1);
Expand Down

0 comments on commit 7efa16c

Please sign in to comment.