Runs the query.

@return Result The documents returned from this query.
341938
public function run()
    {
        $documents = $this->repo->findAll();

        if ($predicates = $this->predicate->getAll()) {
            $documents = $this->filter($documents, $predicates);
        }

        if ($this->orderBy) {
            $sorts = array();
            foreach ($this->orderBy as $order) {
                $parts = explode(' ', $order, 2);
                // TODO - validate parts
                $sorts[] = array(
                    $parts[0],
                    isset($parts[1]) && $parts[1] == 'DESC' ? SORT_DESC : SORT_ASC
                );
            }

            $documents = $this->sort($documents, $sorts);
        }

        $totalCount = count($documents);

        if ($this->limit) {
            list($count, $offset) = $this->limit;
            $documents = array_slice($documents, $offset, $count);
        }

        return new Result(array_values($documents), $totalCount);
    }
814200
public function run()
    {
        $model = $this->findModel();
        $model->content = $this->parseBaseTemplateParams($model->content);

        return $this->controller->render($this->view, [
            'model' => $model,
            'commentWidgetParams' => $this->commentWidgetParams,
        ]);
    }
86316
public function run()
    {
        $data = [];

        if ($this->term) {
            $data = $this->query->asArray()->all();
        }

        Yii::$app->response->format = Response::FORMAT_JSON;
        return $data;
    }
423040
public function run() {

		// Execute query only if categories are not provided and search by type is enabled.
		if( count( $this->categories ) == 0 && $this->searchByType ) {

			// Generate category following parent child relationship.
			if( $this->levelList ) {

				$this->categories = $this->categoryService->getLevelListByType( $this->type );
			}
			// Generat flat list irrespective of parent child relationship.
			else {

				$this->categories = $this->categoryService->getByType( $this->type );
			}
		}

		// Configure parent type
		$this->parentType = isset( $this->parentType ) ? $this->parentType : $this->type;

		return $this->renderWidget();
	}
241030
public function run()
    {
        if (is_null($this->compiledResult)) {
            $this->compiledResult = \preg_replace_callback(static::$rxp_token, array($this, 'formatCallback'), $this->format);
        }

        return $this->compiledResult;
    }
823803
public function run() {
        // Setup connection
        $resource = curl_init();

        // Set cURL options
        foreach ($this->settings as $option => $setting) {
            curl_setopt($resource, $option, $setting);
        }

        // Process headers
        $headers = [];
        foreach ($this->headers as $key => $value) {
            if (!empty($value)) {
                $headers[] = implode(' : ', [$key, $value]);
            }
            else {
                $this->headers[] = $key;
            }
        }

        // Add the headers
        curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

        // Execute cURL
        $response = curl_exec($resource);

        // Get the size of the header
        $header_size = curl_getinfo($resource, CURLINFO_HEADER_SIZE);

        // Get the header from the result
        $headers = substr($response, 0, $header_size);

        // Get the body from the result
        $body = substr($response, $header_size);

        // Get the HTTP response code from the result
        $responseCode = curl_getinfo($resource, CURLINFO_HTTP_CODE);

        // Close the connection
        curl_close($resource);

        // Create Result instance
        $this->result = new Result($body, $responseCode, $headers);

        return $this->result;
    }
668193
public function run()
    {
        $posts_count = Post::count();
        $pages_count = Page::count();

        $users_count = User::count();
        $comments_count = Comment::count();

        return view('admin::widgets.dashboard', compact('posts_count', 'pages_count', 'users_count', 'comments_count'));
    }
350027
public function runOnce()
    {
        $this->startProfiling();

        $result = parent::run(true);

        $this->endProfiling('selectOnce', $result);
        $this->clearParams();

        return $result;
    }
462763
public function execute()
    {
        $this->resultPrinter->printBenchmarkIntro($this);

        $results = array();
        foreach ($this->tests as $test) {
            $testResults = array();
            for ($i = 0; $i < $this->iterations; $i++) {
                $start = time() + microtime();
                $test->run($this->parameters);
                $testResults[] = round((time() + microtime()) - $start, 10);
            }

            $testResults = $this->resultPruner->prune($testResults);

            $this->resultPrinter->printSingleTestResult($test, $testResults);
            $results[$test->getName()] = $testResults;
        }

        $this->resultPrinter->printBenchmarkSummary($this, $results);
        $this->resultPrinter->printBreak();

        return $results;
    }
248977
public function execute()
    {
        if ($this->isIndexRequired() && ! $this->isIndexed()) {
            throw MongoDBException::queryNotIndexed($this->class->name, $this->getUnindexedFields());
        }

        $results = parent::execute();

        if ( ! $this->hydrate) {
            return $results;
        }

        $uow = $this->dm->getUnitOfWork();

        /* A geoNear command returns an ArrayIterator, where each result is an
         * object with "dis" (computed distance) and "obj" (original document)
         * properties. If hydration is enabled, eagerly hydrate these results.
         *
         * Other commands results are not handled, since their results may not
         * resemble documents in the collection.
         */
        if ($this->query['type'] === self::TYPE_GEO_NEAR) {
            foreach ($results as $key => $result) {
                $document = $result['obj'];
                if ($this->class->distance !== null) {
                    $document[$this->class->distance] = $result['dis'];
                }
                $results[$key] = $uow->getOrCreateDocument($this->class->name, $document, $this->unitOfWorkHints);
            }
            $results->reset();
        }

        /* If a single document is returned from a findAndModify command and it
         * includes the identifier field, attempt hydration.
         */
        if (($this->query['type'] === self::TYPE_FIND_AND_UPDATE ||
             $this->query['type'] === self::TYPE_FIND_AND_REMOVE) &&
            is_array($results) && isset($results['_id'])) {

            $results = $uow->getOrCreateDocument($this->class->name, $results, $this->unitOfWorkHints);
        }

        if ( ! empty($this->primers)) {
            $referencePrimer = new ReferencePrimer($this->dm, $uow);

            foreach ($this->primers as $fieldName => $primer) {
                $primer = is_callable($primer) ? $primer : null;
                $documents = $results instanceof Iterator ? $results : array($results);
                $referencePrimer->primeReferences($this->class, $documents, $fieldName, $this->unitOfWorkHints, $primer);
            }
        }

        return $results;
    }
116307
public function run()
    {
        $searchModel = Yii::createObject($this->searchClass);
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->controller->render($this->view, [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
857824
private function runSorting()
    {
        $sort_method = 'sort'.studly_case($this->sortKey);

        // Apply the sorting for the query
        if (method_exists($this, $sort_method)) {
            $this->$sort_method($this->sortOrder);
        } else {
            $this->db->sort($this->sortKey, $this->sortOrder);
        }
    }
99562
public function run()
    {
        try {
            $next = 0;
            $newSort = -1;
            foreach ($this->query->each() as $id => $model) {
                if ($next == $this->order) {
                    $newSort = $next++;
                }
                Podium::getInstance()->db->createCommand()->update(
                        call_user_func([$this->target, 'tableName']), ['sort' => $next], ['id' => $id]
                    )->execute();
                $next++;
            }
            if ($newSort == -1) {
                $newSort = $next;
            }
            $this->target->sort = $newSort;
            if (!$this->target->save()) {
                throw new Exception('Order saving error');
            }
            Log::info('Orded updated', $this->target->id, __METHOD__);
            return true;
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
286859
public function run()
    {
        Url::remember();
        $dataProvider = $this->searchModel->singleSearch(Yii::$app->request->queryParams, $this->query);

        return $this->controller->render($this->view, array_merge([
            'searchModel' => $this->searchModel,
            'dataProvider' => $dataProvider,
        ], $this->params));
    }
785147
public function run()
    {
        $scanTimeLimit = Yii::$app->getModule('translatemanager')->scanTimeLimit;

        if (!is_null($scanTimeLimit)) {
            set_time_limit($scanTimeLimit);
        }

        $scanners = Yii::$app->getModule('translatemanager')->scanners;
        if (!empty($scanners)) {
            $this->scanners = $scanners; // override scanners from module configuration (custom scanners)
        }

        $this->_initLanguageArrays();

        $languageSource = new LanguageSource();

        return $languageSource->insertLanguageItems($this->_languageElements);
    }
782066
public function run() {
        $this->input = new Input($this->docoptResult);
        $this->di()->set(Input::class, $this->input);

        if ($this->validator) $error = $this->validator->__invoke($this->input, $this->output);
        else                  $error = $this->validate($this->input, $this->output);

        if ($error)
            return $this->status = (int) $error;

        if ($this->task) $status = $this->task->__invoke($this->input, $this->output);
        else             $status = $this->execute($this->input, $this->output);

        return $this->status = (int) $status;
    }
1215267
public function run()
	{
		$this->resultset = $this->connection->select($this->query);
		$this->numFound = $this->resultset->getNumFound();
		$this->results = $this->getResults();
		$this->resultsFacetSet = $this->resultset->getFacetSet();
		return $this;
	}