Programming Language PHP

Namespace Oro\Component\PhpUtils

Class QueryStringUtil

Method/Function addQueryString

Total Examples 3

3 code examples of PHP Oro\Component\PhpUtils\QueryStringUtil::addQueryString extracted from open source projects

Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    public function getHref(DataAccessorInterface $dataAccessor): ?string
    {
        $pageNumber = null;
        if (!$dataAccessor->tryGetValue(ConfigUtil::PAGE_NUMBER, $pageNumber)) {
            // the pagination is not supported
            return null;
        }
        if ($pageNumber <= 1) {
            // the link to the previous page is not needed
            return null;
        }

        $prevPageNumber = $pageNumber - 1;
        $baseUrl = parent::getHref($dataAccessor);
        $queryString = null !== $this->queryStringAccessor
            ? $this->queryStringAccessor->getQueryString()
            : '';
        if ($prevPageNumber > 1) {
            $queryString = QueryStringUtil::addParameter(
                $queryString,
                $this->pageNumberFilterName,
                (string) $prevPageNumber
            );
        } else {
            $queryString = QueryStringUtil::removeParameter($queryString, $this->pageNumberFilterName);
        }

        return QueryStringUtil::addQueryString($baseUrl, $queryString);
    }
                                            
Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    public function getHref(DataAccessorInterface $dataAccessor): ?string
    {
        if (!$this->hasMoreRecords($dataAccessor)) {
            return null;
        }

        $pageNumber = null;
        if (!$dataAccessor->tryGetValue(ConfigUtil::PAGE_NUMBER, $pageNumber)
            && null !== $this->queryStringAccessor
        ) {
            // the pagination is not supported
            return null;
        }
        if (null === $pageNumber) {
            $pageNumber = 1;
        }

        $nextPageNumber = $pageNumber + 1;
        $baseUrl = parent::getHref($dataAccessor);
        $queryString = null !== $this->queryStringAccessor
            ? $this->queryStringAccessor->getQueryString()
            : '';
        $queryString = QueryStringUtil::addParameter(
            $queryString,
            $this->pageNumberFilterName,
            (string) $nextPageNumber
        );

        return QueryStringUtil::addQueryString($baseUrl, $queryString);
    }
                                            
Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    public function getHref(DataAccessorInterface $dataAccessor): ?string
    {
        $pageNumber = null;
        if (!$dataAccessor->tryGetValue(ConfigUtil::PAGE_NUMBER, $pageNumber)) {
            // the pagination is not supported
            return null;
        }
        if ($pageNumber <= 1) {
            // the link to the first page is not needed
            return null;
        }

        $baseUrl = parent::getHref($dataAccessor);
        $queryString = null !== $this->queryStringAccessor
            ? $this->queryStringAccessor->getQueryString()
            : '';
        $queryString = QueryStringUtil::removeParameter($queryString, $this->pageNumberFilterName);

        return QueryStringUtil::addQueryString($baseUrl, $queryString);
    }
                                            
QueryStringUtil's Other Methods