Builds the given query element

@param   string  $type  The query element to build
@return  string
@since   2.0.0
498866
public function build($type)
	{
		if (empty($this->{$type}))
		{
			return false;
		}

		$method = 'build' . ucfirst($type);

		return $this->{$method}();
	}
374323
protected function buildQuery()
	{
		$this->setup();

		$query = array();

		// Index always needs to be provided. _all means a cross index search.
		$query['index'] = empty($this->indices) ? '_all' : implode(',', array_values($this->indices));

		// Type is not required, will search in the entire index.
		if (!empty($this->types)) {
			$query['type'] = implode(',', array_values($this->types));
		}

		// Replace Fragments with their raw body.
		$query['body'] = $this->fragmentParser->parse($this->body);

		// Add all query string params, the SDK will only add known params to the URL.
		foreach ($this->queryStringParams as $paramName => $paramValue) {
			$query[$paramName] = $paramValue;
		}

		return $query;
	}
688353
public function display($type = null)
    {
        $result = '';

        if ( ! is_null($type) && ! in_array($type, $this->types)) {
            return $result;
        }

        if (in_array($type, $this->types)) {
            $result .= $this->buildMessages($_SESSION[$this->key][$type], $type);
        } elseif (is_null($type)) {
            foreach ($_SESSION[$this->key] as $messageType => $messages) {
                $result .= $this->buildMessages($messages, $messageType);
            }
        }

        $this->clear($type);

        return $result;
    }
943719
public function buildQueryType(
        string $type,
        QueryTypeHandlerInterface $handler,
        array $config
    ): QueryTypeInterface {
        $parameterBuilder = $this->parameterBuilderFactory->createParameterBuilder();
        $handler->buildParameters($parameterBuilder);
        $parameterDefinitions = $parameterBuilder->buildParameterDefinitions();

        return QueryType::fromArray(
            [
                'type' => $type,
                'isEnabled' => $config['enabled'],
                'name' => $config['name'] ?? '',
                'handler' => $handler,
                'parameterDefinitions' => $parameterDefinitions,
            ]
        );
    }
828101
public function getElementInstance($type)
	{
		$class = $this->elementNamespace . ucfirst($type);

		if (array_key_exists($type, $this->customTypes))
		{
			$class = $this->customTypes[$type];
		}

		// TODO: Throw exception if the class cannot be found
		return new $class;
	}
775042
public function copy($type = null)
    {
        $builder = new Builder($this->type, $this->dogmatist, $this->parent, $this->strict);
        $this->copyData($builder);

        if ($type !== null) {
            $builder->setType($type);
        }

        return $builder;
    }
36267
public function fetch($type = parent::FETCH_TYPE_NUM)
    {
        $callback = $this->_callback;
        $row = $this->_statement->fetch($type);

        return $row === false ? $row : $callback($row);
    }
1321784
public function getType($type)
    {
        if (!$this->hasType($type)) {
            $this->metaTypeList[$type] = new $type();
        }

        return $this->metaTypeList[$type];
    }
679830
public function actionCreate($type)
    {
        if (!is_term_type_name($type)) {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
        $model = new Term();
        $model->term_type = $type;
        if ($model->loadAll(request()->post())) {
            $model->term_type = $type;
            if ($model->saveAll()) {
                set_flash_has_been_saved();
                $seo = new Seo([
                    'title'              => $model->name,
                    'slug'               => $model->slug,
                    'description'        => substr(strip_tags($model->description), 0, 255),
                    'social_image'       => $model->feature_img,
                    'social_title'       => $model->name,
                    'social_description' => substr(strip_tags($model->description), 0, 255),
                    'obj_type'           => $model->term_type,
                    'obj_id'             => $model->id,
                ]);
                $seo->save();

                return $this->redirect([
                    'update',
                    'id' => $model->id,
                ]);
            } else {
                set_flash_has_not_been_saved();

                return $this->render('create', [
                    'model'    => $model,
                    'termType' => $type,
                ]);
            }
        }

        return $this->render('create', [
            'model'    => $model,
            'termType' => $type,
        ]);
    }
644035
protected function getFormElements($type = 'list', $element)
    {
        $form = array();
        $template = $this->getTemplate("{$type}-block");
        $attributes = $this->getModelAttributes($this->tableInfo);

        foreach($attributes as $name)
        {
            $form[] = $this->renderElement($template, $element, $name);
        }

        return implode(PHP_EOL . PHP_EOL, $form);
    }
1366757
public function build(Query $query): string
    {
        $this->query = $query;

        $sql = $this->buildQueryStart();

        switch ($this->query->getType()) {
            case Query\Type::INSERT:
                $sql .=
                    $this->buildInto() .
                    $this->buildSet();
                break;
            case Query\Type::SELECT:
                $sql .=
                    $this->buildColumns() .
                    $this->buildFrom() .
                    $this->buildWhere() .
                    $this->buildOrderBy() .
                    $this->buildGroupBy() .
                    $this->buildLimit();
                break;
            case Query\Type::UPDATE:
                $sql .=
                    ' ' . $this->query->getTable() . ' t' .
                    $this->buildSet() .
                    $this->buildWhere();
                break;
            case Query\Type::DELETE:
                $sql .=
                    $this->buildFrom() .
                    $this->buildWhere();
                break;
            default:
                throw new \UnexpectedValueException('Unexpected value of property $type');
        }

        return $sql;
    }
929212
public function useBoostQueriesFromTypoScript(): QueryBuilder
    {
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();

        if (!empty($searchConfiguration['query.']['boostQuery'])) {
            return $this->useBoostQueries($searchConfiguration['query.']['boostQuery']);
        }

        if (!empty($searchConfiguration['query.']['boostQuery.'])) {
            $boostQueries = $searchConfiguration['query.']['boostQuery.'];
            return $this->useBoostQueries(array_values($boostQueries));
        }

        return $this;
    }
525214
public function apiQueryString($type)
    {
        // basic query
        $query = ['ngrestCallType' => $type];

        $fields = [];
        foreach ($this->model->primaryKey() as $n) {
            $fields[] = $n;
        }
        // see if we have fields for this type
        if (count($this->getFields($type)) > 0) {
            foreach ($this->getFields($type) as $field) {
                $fields[] = $field;
            }
        }
        // do we have extra fields to expand
        if (count($this->config->getPointerExtraFields($type)) > 0) {
            $query['expand'] = implode(',', $this->config->getPointerExtraFields($type));
        }
        
        array_unique($fields);
        $query['fields'] = implode(",", $fields);

        if (Yii::$app->request->get('pool')) {
            $query['pool'] = Yii::$app->request->get('pool');
        }

        // return url decoded string from http_build_query
        return http_build_query($query, '', '&');
    }
1063302
protected function buildBreadcrumbs($type)
    {
        /** @var Breadcrumbs $breadcrumbs */
        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addItem('navigation.home', $this->get('router')->generate('clastic_backoffice_dashboard'));

        /** @var NodeModuleInterface $module */
        $module = $this->get('clastic.module_manager')->getModule($type);
        if ($module) {
            $breadcrumbs->addItem($module->getName(), $this->get('router')->generate('clastic_node_list', array(
                'type' => $type,
            )));
        }

        return $breadcrumbs;
    }
593050
public function scopeWithType(Builder $query, $type)
    {
        // We do this for querying, searching and sorting with source attributes
        $this->setNodeTypeName($type);

        return $this->scopeWhereTranslation($query, 'source_type', $type, null);
    }
444670
public function query($type) {
        $query = $this->getDriver()->newQuery($type);
        $query->setRepository($this);
        $query->from($this->getTable(), $this->getAlias());

        return $query;
    }
1159930
public function build($type)
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown request type.");
        }
        return new $this->types[$type]();
    }