Esempio n. 1
0
 public function search($index, $type, array $query)
 {
     $url = static::formUrl($index, $type) . '_search';
     $response = $this->client->request('POST', $url, ['json' => $query]);
     $hits = Json::parse($response->getBody())['hits'];
     return $hits['hits'];
 }
Esempio n. 2
0
 /**
  * @param SessionInterface $session
  * @param Response $response
  */
 private function postRequestHandle(SessionInterface $session, Response $response)
 {
     if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
         $id = $session->getId();
         $key = 'session:' . $id;
         $content = $session->all();
         unset($content['_token'], $content['flash']);
         $lastSeen = time();
         $content['last_seen'] = $lastSeen;
         $session->set('last_seen', $lastSeen);
         $value = Json::dump($content);
         $this->redis->watch($key);
         $this->redis->multi();
         $this->redis->set($key, $value);
         $this->redis->expire($key, $this->getSessionLifetimeInSeconds());
         $this->redis->exec();
         $cookie = new Cookie($this->key, $id, $this->getCookieExpirationDate(), $config['path'], $config['domain'], Arr::get($config, 'secure', false));
         $response->headers->setCookie($cookie);
     }
 }
Esempio n. 3
0
 public function testParse()
 {
     $data = ["query" => ["match" => ["address" => "mill"]]];
     $output = Json::parse('{"query": { "match": { "address": "mill" } }}', true);
     $this->assertSame($data, $output);
 }