ConditionInterface.php 1.81 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Drupal\Core\Entity\Query;

/**
 * Defines the entity query condition interface.
 */
interface ConditionInterface {

  /**
   * Gets the current conjunction.
   *
   * @return string
   *   Can be AND or OR.
   */
  public function getConjunction();

  /**
19
   * Implements \Countable::count().
20
21
   *
   * Returns the size of this conditional. The size of the conditional is the
22
   * size of its conditional array minus one, because one element is the
23
24
25
26
27
28
29
   * conjunction.
   */
  public function count();

  /**
   * Adds a condition.
   *
30
   * @param string|\Drupal\Core\Entity\Query\ConditionInterface $field
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
   * @param mixed $value
   * @param string $operator
   * @param string $langcode
   * @return ConditionInterface
   * @see \Drupal\Core\Entity\Query\QueryInterface::condition()
   */
  public function condition($field, $value = NULL, $operator = NULL, $langcode = NULL);

  /**
   * Queries for the existence of a field.
   *
   * @param $field
   * @param string $langcode
   * @return ConditionInterface
   * @see \Drupal\Core\Entity\Query\QueryInterface::exists()
   */
  public function exists($field, $langcode = NULL);

  /**
   * Queries for the existence of a field.
   *
   * @param string $field
53
   * @return ConditionInterface
54
   * @see \Drupal\Core\Entity\Query\QueryInterface::notExists()
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
   */
  public function notExists($field, $langcode = NULL);

  /**
   * Gets a complete list of all conditions in this conditional clause.
   *
   * This method returns by reference. That allows alter hooks to access the
   * data structure directly and manipulate it before it gets compiled.
   *
   * @return array
   */
  public function &conditions();

  /**
   * Compiles this conditional clause.
   *
   * @param $query
   *   The query object this conditional clause belongs to.
   */
  public function compile($query);
75

76
}