Overview

Namespaces

  • Affilinet
    • ProductData
      • Exceptions
      • HttpClient
      • Requests
        • Helper
        • Traits
      • Responses
        • ResponseElements

Classes

  • Affilinet\ProductData\AffilinetClient
  • Affilinet\ProductData\HttpClient\GuzzleClient
  • Affilinet\ProductData\Requests\AbstractRequest
  • Affilinet\ProductData\Requests\CategoriesRequest
  • Affilinet\ProductData\Requests\Helper\Expression
  • Affilinet\ProductData\Requests\Helper\Query
  • Affilinet\ProductData\Requests\ProductsRequest
  • Affilinet\ProductData\Requests\ShopPropertiesRequest
  • Affilinet\ProductData\Requests\ShopsRequest
  • Affilinet\ProductData\Responses\AbstractResponse
  • Affilinet\ProductData\Responses\CategoriesResponse
  • Affilinet\ProductData\Responses\ProductsResponse
  • Affilinet\ProductData\Responses\ResponseElements\Category
  • Affilinet\ProductData\Responses\ResponseElements\Facet
  • Affilinet\ProductData\Responses\ResponseElements\FacetValue
  • Affilinet\ProductData\Responses\ResponseElements\Image
  • Affilinet\ProductData\Responses\ResponseElements\Price
  • Affilinet\ProductData\Responses\ResponseElements\Product
  • Affilinet\ProductData\Responses\ResponseElements\Shop
  • Affilinet\ProductData\Responses\ResponseElements\ShopProperty
  • Affilinet\ProductData\Responses\ShopPropertiesResponse
  • Affilinet\ProductData\Responses\ShopsResponse

Interfaces

  • Affilinet\ProductData\HttpClient\HttpClientInterface
  • Affilinet\ProductData\Requests\CategoriesRequestInterface
  • Affilinet\ProductData\Requests\Helper\ExpressionInterface
  • Affilinet\ProductData\Requests\Helper\QueryInterface
  • Affilinet\ProductData\Requests\ProductsRequestInterface
  • Affilinet\ProductData\Requests\RequestInterface
  • Affilinet\ProductData\Requests\ShopPropertiesRequestInterface
  • Affilinet\ProductData\Requests\ShopsRequestInterface
  • Affilinet\ProductData\Responses\CategoriesResponseInterface
  • Affilinet\ProductData\Responses\ProductsResponseInterface
  • Affilinet\ProductData\Responses\ResponseElements\CategoryInterface
  • Affilinet\ProductData\Responses\ResponseElements\FacetInterface
  • Affilinet\ProductData\Responses\ResponseElements\FacetValueInterface
  • Affilinet\ProductData\Responses\ResponseElements\ImageInterface
  • Affilinet\ProductData\Responses\ResponseElements\PriceInterface
  • Affilinet\ProductData\Responses\ResponseElements\ProductInterface
  • Affilinet\ProductData\Responses\ResponseElements\ShopInterface
  • Affilinet\ProductData\Responses\ResponseElements\ShopPropertyInterface
  • Affilinet\ProductData\Responses\ResponseInterface
  • Affilinet\ProductData\Responses\ShopPropertiesResponseInterface
  • Affilinet\ProductData\Responses\ShopsResponseInterface

Traits

  • Affilinet\ProductData\Requests\Traits\ImageTrait
  • Affilinet\ProductData\Requests\Traits\LogoTrait
  • Affilinet\ProductData\Requests\Traits\PaginationTrait
  • Affilinet\ProductData\Requests\Traits\ShopLogoTrait
  • Affilinet\ProductData\Responses\DataParser

Exceptions

  • Affilinet\ProductData\Exceptions\AffilinetProductWebserviceException
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 
<?php

/*
 * This file is part of the affilinet Product Data PHP SDK.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Affilinet\ProductData\Requests\Helper;

/**
 * Class QueryBuilderTrait
 *
 * The keyword(s) you want the products to match. Can be any
 * length. The following search operators are supported:
 *      - AND (both query tokens must be contained in the product, but not necessarily next to one another)
 *      - OR (any of the query tokens must be contained in the product)
 *      - NOT (e.g. with “ipod AND NOT nano”, you will get products, which match the query “ipod”, but at the same time don’t match “nano”)
 *      - "(phrase match: all query tokens inclosed with double quotes must be contained in the found products in that order)
 *      - () Parentheses, to group expressions So you can formulate a query like this: "apple ipod" ((touch OR classic) NOT nano) AND "32  GB"
 *
 * SearchProducts supports the wildcard ‘*’ for suffix matching, that
 * is: a query ‘bott*’ will match for products, which contain the word
 * “bottle” or the word “bottom”.
 * Search operators “AND”, “OR” and “NOT” must be in capital
 * letters.
 *
 *  */
class Query implements QueryInterface
{

    private $query = '';

    /**
     * @return string
     */
    public function getQuery()
    {
       return $this->query;
    }

    /**
     * @param  Expression     $expression
     * @return QueryInterface
     */
    public function where(Expression $expression, $operator = 'AND')
    {
        if ($this->query != '') {
            $this->query .= ' '. $operator . ' ';
        }
        $this->query .=  ' (' . $expression->getExpression() . ' ) ';

        return $this;
    }

    /**
     * @param  Expression     $expression
     * @return QueryInterface
     */
    public function andWhere(Expression $expression)
    {
        return $this->where($expression, 'AND');

    }

    /**
     * @param  Expression     $expression
     * @return QueryInterface
     */
    public function orWhere(Expression $expression)
    {
        return $this->where($expression, 'OR');

    }

    public function expr()
    {
        return new Expression();
    }

}
API documentation generated by ApiGen