diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-01-04 13:13:58 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-01-04 13:13:58 +0300 |
commit | 985f19ff32ddab1cfb3871c46ba6d0da0e6a53d1 (patch) | |
tree | 5cda7ea261d3112718fcf11ec152b8f21a182c0b /lib/Model | |
parent | 0011b18483cebbf2582d6e77a1ac51c79810f523 (diff) |
providers is now set in the request, not in the url
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/SearchRequest.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/Model/SearchRequest.php b/lib/Model/SearchRequest.php index 776ee88..4bba3d6 100644 --- a/lib/Model/SearchRequest.php +++ b/lib/Model/SearchRequest.php @@ -30,6 +30,9 @@ use OCA\FullNextSearch\Service\MiscService; class SearchRequest implements \JsonSerializable { + /** @var array */ + private $providers; + /** @var string */ private $search; @@ -48,6 +51,25 @@ class SearchRequest implements \JsonSerializable { /** + * @return array + */ + public function getProviders() { + return $this->providers; + } + + /** + * @param string|array $providers + */ + public function setProviders($providers) { + if (!is_array($providers)) { + $providers = [$providers]; + } + + $this->providers = $providers; + } + + + /** * @return string */ public function getSearch() { @@ -105,9 +127,10 @@ class SearchRequest implements \JsonSerializable { */ public function jsonSerialize() { return [ - 'search' => $this->getSearch(), - 'page' => $this->getPage(), - 'size' => $this->getSize() + 'providers' => $this->getProviders(), + 'search' => $this->getSearch(), + 'page' => $this->getPage(), + 'size' => $this->getSize() ]; } @@ -128,6 +151,7 @@ class SearchRequest implements \JsonSerializable { */ public static function fromArray($arr) { $request = new SearchRequest(); + $request->setProviders($arr['providers']); $request->setSearch(MiscService::get($arr, 'search', '')); $request->setPage(MiscService::get($arr, 'page', 0)); $request->setSize(MiscService::get($arr, 'size', 10)); |