if ($connection->isAlive() === true) { return $connection; } if ($this->readyToRevive($connection) === true) { return $connection; } } throw new NoNodesAvailableException("No alive nodes found in your cluster"); } public function scheduleCheck() { } /** * @param \Elasticsearch\Connections\Connection $connection *
* * @return ConnectionInterface Connection */ public function getConnection() { return $this->connectionPool->nextConnection(); } /** * Perform a request to the Cluster * * @param string $method HTTP method to use
* @throws Common\Exceptions\NoNodesAvailableException|\Exception * @return FutureArrayInterface */ public function performRequest($method, $uri, $params = null, $body = null, $options = []) { try { $connection = $this->getConnection(); } catch (Exceptions\NoNodesAvailableException $exception) { $this->log->critical('No alive nodes found in cluster'); throw $exception; } $response = array();
$shouldRetry = $transport->shouldRetry($request); $shouldRetryText = ($shouldRetry) ? 'true' : 'false'; $this->log->warning("Retries left? $shouldRetryText"); if ($shouldRetry && !$neverRetry) { return $transport->performRequest( $request['http_method'], $request['uri'], [], $request['body'], $options ); }
{ if (null === $onFulfilled) { return $this; } try { return resolve($onFulfilled($this->value)); } catch (\Throwable $exception) { return new RejectedPromise($exception); } catch (\Exception $exception) { return new RejectedPromise($exception); } }
public function then( callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null ) { return $this->promise()->then($onFulfilled, $onRejected, $onProgress); } }
FutureArrayInterface $future, callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null ) { return new FutureArray( $future->then($onFulfilled, $onRejected, $onProgress), [$future, 'wait'], [$future, 'cancel'] ); } /**
$response['body'], $response['transfer_stats']['total_time'] ); return isset($request['client']['verbose']) && $request['client']['verbose'] === true ? $response : $response['body']; }); return $response; }; } /**
]; $request = array_merge_recursive($request, $this->connectionParams, $options); $handler = $this->handler; $future = $handler($request, $this, $transport, $options); return $future; } /** @return string */ public function getTransportSchema()
$response = array(); $caughtException = null; $this->lastConnection = $connection; $future = $connection->performRequest( $method, $uri, $params, $body, $options, $this );
{ $promise = $this->transport->performRequest( $endpoint->getMethod(), $endpoint->getURI(), $endpoint->getParams(), $endpoint->getBody(), $endpoint->getOptions() ); return $this->transport->resultOrFuture($promise, $endpoint->getOptions()); } }
$endpoint = $endpointBuilder('Get'); $endpoint->setID($id) ->setIndex($index) ->setType($type); $endpoint->setParams($params); return $this->performRequest($endpoint); } /** * $params['id'] = (string) The document ID (Required) * ['index'] = (string) The name of the index (Required) * ['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required)
'filter_path' => '_source.filter_filters.*', 'type' => FiltersTypeDTO::TYPE_NAME, 'id' => $term ]; try { $results = $this->client->get($params); $results = $results['_source']['filter_filters']; } catch (Missing404Exception $e) { $results = []; } catch (ErrorException $e) { $results = []; }
{ return FiltersTypeDTO::TYPE_NAME; } public function get($term) { return $filtersArray = $this->searchRepository->getFilters($term); } }
$this->redeclarationMapping(); } public function getFiltersForCategory(Category $category): array { $filtersArray = $this->get($category->id); $filterModels = []; if (!empty($filtersArray)) { /** @var CharacteristicsFilter $filter */ foreach ($filtersArray as $filter) { $dto = $this->filterService->generateFilterDTOFromArray($filter);
/** * @param Category $category * @return CatalogFilterForm */ public function createFiltersForCategory(Category $category): CatalogFilterForm { $characteristicFilterForms = $this->esFiltersTypeManager->getFiltersForCategory($category); return new CatalogFilterForm($characteristicFilterForms); } /** * @param $category
{ /** @var Category $category*/ if (!$category = $this->categories->findWithParents($id)) { throw new NotFoundHttpException('The requested page does not exist.'); } $catalogFilterForm = $this->service->createFiltersForCategory($category); if ($catalogFilterForm->load(Yii::$app->request->get()) && $catalogFilterForm->validate()) { $dataProvider = $this->service->getAllProductsByCategoryAndApplyFilter($category, $catalogFilterForm); } else { $dataProvider = $this->service->getAllProductsByCategory($category); }
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run();
$_GET = [ 'id' => 104, ]; $_SESSION = [ '__flash' => [], 'location_userLocation' => 'O:26:"shop\\location\\UserLocation":12:{s:11:"countryName";s:12:"Россия";s:10:"countryIso";s:2:"RU";s:8:"cityName";s:12:"Москва";s:8:"citySlug";s:6:"moskva";s:19:"isCityGlobalDefault";b:1;s:36:"' . "\0" . 'shop\\location\\UserLocation' . "\0" . 'cityInDb";b:1;s:9:"countryId";i:1;s:39:"' . "\0" . 'shop\\location\\UserLocation' . "\0" . 'countryInDb";b:1;s:15:"countryIsActive";b:1;s:35:"' . "\0" . 'shop\\location\\UserLocation' . "\0" . 'storage";O:44:"shop\\location\\storage\\SessionLocationStorage":0:{}s:37:"' . "\0" . 'shop\\location\\UserLocation' . "\0" . 'countries";O:40:"shop\\repositories\\i18n\\CountryRepository":0:{}s:34:"' . "\0" . 'shop\\location\\UserLocation' . "\0" . 'cities";O:37:"shop\\repositories\\i18n\\CityRepository":1:{s:44:"' . "\0" . 'shop\\repositories\\i18n\\CityRepository' . "\0" . 'cache";O:58:"shop\\managers\\cache\\containers\\i18n\\i18nApcuCacheContainer":2:{s:56:"' . "\0" . 'shop\\managers\\cache\\containers\\BaseCacheContainer' . "\0" . 'cache";O:20:"yii\\caching\\ApcCache":8:{s:7:"useApcu";b:1;s:9:"keyPrefix";s:4:"apcu";s:10:"serializer";N;s:15:"defaultDuration";i:0;s:37:"' . "\0" . 'yii\\caching\\Cache' . "\0" . '_igbinaryAvailable";b:0;s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:35:"' . "\0" . 'yii\\base\\Component' . "\0" . '_eventWildcards";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";N;}s:12:"dataProvider";O:63:"shop\\managers\\cache\\containers\\DataProviderCacheContainerWorker":1:{s:79:"' . "\0" . 'shop\\managers\\cache\\containers\\DataProviderCacheContainerWorker' . "\0" . 'cacheContainer";r:14;}}}}', ];