just another orm...
View the Project on GitHub tflori/orm
» API Reference » ORM\QueryBuilder\Parenthesis
Implements: ORM\QueryBuilder\ParenthesisInterface
public function __construct(
callable $onClose,
\ORM\QueryBuilder\ParenthesisInterface $parent,
)
Create a parenthesis inside another parenthesis or a query.
Parameter | Type | Description |
---|---|---|
$onClose |
callable | Callable that gets executed when the parenthesis get closed |
$parent |
ORM\QueryBuilder\ParenthesisInterface | Parent where createWhereCondition get executed |
ORM\QueryBuilder\Parenthesis::__construct
public function andParenthesis(): $this
Returns | $this |
ORM\QueryBuilder\Parenthesis::andParenthesis
public function andWhere(
string $column,
string|array $operator = null,
string $value = null,
): $this
QueryBuilderInterface andWhere($column[, $operator[, $value]]);
If $column has the same amount of question marks as $value - $value is the second parameter.
If there is no third parameter and no question mark in $column then the default operator is ‘=’ and $value is the second parameter.
These calls are equal:
$query->andWhere('name', '=' , 'John Doe');
$query->andWhere('name = ?', 'John Doe');
$query->andWhere('name', 'John Doe');
$query->andWhere('name = ?', ['John Doe']);
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
string | Column or expression with placeholders | |
$operator |
**string | array** | Operator, value or array of values |
$value |
string | Value (required when used with operator) |
ORM\QueryBuilder\Parenthesis::andWhere
public function close(
,
): \ORM\QueryBuilder\QueryBuilderInterface|\ORM\QueryBuilder\ParenthesisInterface
Returns | ORM\QueryBuilder\QueryBuilderInterface|ORM\QueryBuilder\ParenthesisInterface |
ORM\QueryBuilder\Parenthesis::close
public function getExpression(): string
Returns | string |
ORM\QueryBuilder\Parenthesis::getExpression
public function orParenthesis(): $this
Returns | $this |
ORM\QueryBuilder\Parenthesis::orParenthesis
public function orWhere(
string $column,
string|array $operator = null,
string $value = null,
): $this
QueryBuilderInterface orWhere($column[, $operator[, $value]]);
If $column has the same amount of question marks as $value - $value is the second parameter.
If there is no third parameter and no question mark in $column then the default operator is ‘=’ and $value is the second parameter.
These calls are equal:
$query->orWhere('name', '=' , 'John Doe');
$query->orWhere('name = ?', 'John Doe');
$query->orWhere('name', 'John Doe');
$query->orWhere('name = ?', ['John Doe']);
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
string | Column or expression with placeholders | |
$operator |
**string | array** | Operator, value or array of values |
$value |
string | Value (required when used with operator) |
ORM\QueryBuilder\Parenthesis::orWhere
public function orWhereIn(string|array $column, array $values): $this
If $column is an array a composite where in statement will be created
Example:
whereIn(['a', 'b'], [[42, 23], [42, 23]])
gets (a,b) IN ((42,23), (23,42))
in mysql
If $values is empty the expression will be 1 = 0
because an empty parenthesis causes an error in SQL.
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
**string | array** | |
$values |
array |
ORM\QueryBuilder\Parenthesis::orWhereIn
public function orWhereNotIn(string|array $column, array $values): $this
If $column is an array a composite where in statement will be created
Example:
whereIn(['a', 'b'], [[42, 23], [42, 23]])
gets (a,b) NOT IN ((42,23), (23,42))
in mysql
If $values is empty the expression will be 1 = 1
because an empty parenthesis causes an error in SQL.
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
**string | array** | |
$values |
array |
ORM\QueryBuilder\Parenthesis::orWhereNotIn
public function parenthesis(): $this
Returns | $this |
ORM\QueryBuilder\Parenthesis::parenthesis
public function where(
string $column,
mixed $operator = null,
mixed $value = null,
): $this
QueryBuilderInterface where($column[, $operator[, $value]]);
If $column has the same amount of question marks as $value - $value is the second parameter.
If there is no third parameter and no question mark in $column then the default operator is ‘=’ and $value is the second parameter.
These calls are equal:
$query->where('name', '=' , 'John Doe');
$query->where('name = ?', 'John Doe');
$query->where('name', 'John Doe');
$query->where('name = ?', ['John Doe']);
Returns | $this |
Parameter | Type | Description |
---|---|---|
$column |
string | Column or expression with placeholders |
$operator |
mixed | Operator, value or array of values |
$value |
mixed | Value (required when used with operator) |
See Also:
ORM\QueryBuilder\Parenthesis::where
public function whereIn(string|array $column, array $values): $this
If $column is an array a composite where in statement will be created
Example:
whereIn(['a', 'b'], [[42, 23], [42, 23]])
gets (a,b) IN ((42,23), (23,42))
in mysql
If $values is empty the expression will be 1 = 0
because an empty parenthesis causes an error in SQL.
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
**string | array** | |
$values |
array |
ORM\QueryBuilder\Parenthesis::whereIn
public function whereNotIn(string|array $column, array $values): $this
If $column is an array a composite where in statement will be created
Example:
whereIn(['a', 'b'], [[42, 23], [42, 23]])
gets (a,b) NOT IN ((42,23), (23,42))
in mysql
If $values is empty the expression will be 1 = 1
because an empty parenthesis causes an error in SQL.
Returns | $this |
Parameter | Type | Description | |
---|---|---|---|
$column |
**string | array** | |
$values |
array |
ORM\QueryBuilder\Parenthesis::whereNotIn