/
ProductQueryBuilderInterface.php
75 lines (67 loc) · 1.99 KB
/
ProductQueryBuilderInterface.php
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
<?php
namespace Pim\Component\Catalog\Query;
use Akeneo\Component\StorageUtils\Cursor\CursorInterface;
/**
* Aims to customize a query builder to add useful shortcuts which allow to easily select, filter or sort a product
* values
*
* @author Nicolas Dupont <nicolas@akeneo.com>
* @copyright 2013 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
interface ProductQueryBuilderInterface
{
/**
* Add a filter condition on a field
*
* @param string $field the field
* @param string $operator the used operator
* @param string $value the value to filter
* @param array $context the filter context, used for locale and scope
*
* @throws \LogicException
*
* @return ProductQueryBuilderInterface
*/
public function addFilter($field, $operator, $value, array $context = []);
/**
* Sort by field
*
* @param string $field the field to sort on
* @param string $direction the direction to use
* @param array $context the sorter context, used for locale and scope
*
* @throws \LogicException
*
* @return ProductQueryBuilderInterface
*/
public function addSorter($field, $direction, array $context = []);
/**
* Returns applied filters
*
* @return array
*/
public function getRawFilters();
/**
* Get query builder
*
* @throws \LogicException in case the query builder has not been configured
*
* @return \Doctrine\ORM\QueryBuilder|\Doctrine\ODM\MongoDB\Query\Builder
*/
public function getQueryBuilder();
/**
* Set query builder
*
* @param \Doctrine\ORM\QueryBuilder|\Doctrine\ODM\MongoDB\Query\Builder $queryBuilder
*
* @return ProductQueryBuilderInterface
*/
public function setQueryBuilder($queryBuilder);
/**
* Executes a query
*
* @return CursorInterface
*/
public function execute();
}