tflori/orm

just another orm...

View the Project on GitHub tflori/orm

Build Status Test Coverage Maintainability Latest Stable Version Total Downloads

» API Reference » ORM\QueryBuilder\HasWhereConditions

ORM\QueryBuilder\HasWhereConditions

Table of Contents

Abstract

Methods

ORM\QueryBuilder\HasWhereConditions::andWhere

public function andWhere(
    string $column, 
    string|array $operator = null, 
    string $value = null, 
): $this
Add a where condition with AND.

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  
Parameters
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\HasWhereConditions::andWhere

↑ top


ORM\QueryBuilder\HasWhereConditions::orWhere

public function orWhere(
    string $column, 
    string|array $operator = null, 
    string $value = null, 
): $this
Add a where condition with OR.

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  
Parameters
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\HasWhereConditions::orWhere

↑ top


ORM\QueryBuilder\HasWhereConditions::orWhereIn

public function orWhereIn(string|array $column, array $values): $this
Add a where in condition with OR.

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  
Parameters
Parameter Type Description  
$column **string array**  
$values array    

ORM\QueryBuilder\HasWhereConditions::orWhereIn

↑ top


ORM\QueryBuilder\HasWhereConditions::orWhereNotIn

public function orWhereNotIn(string|array $column, array $values): $this
Add a where not in condition with OR.

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  
Parameters
Parameter Type Description  
$column **string array**  
$values array    

ORM\QueryBuilder\HasWhereConditions::orWhereNotIn

↑ top


ORM\QueryBuilder\HasWhereConditions::where

public function where(
    string $column, 
    mixed $operator = null, 
    mixed $value = null, 
): $this
Alias for andWhere

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  
Parameters
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\HasWhereConditions::where

↑ top


ORM\QueryBuilder\HasWhereConditions::whereIn

public function whereIn(string|array $column, array $values): $this
Add a where in condition with AND.

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  
Parameters
Parameter Type Description  
$column **string array**  
$values array    

ORM\QueryBuilder\HasWhereConditions::whereIn

↑ top


ORM\QueryBuilder\HasWhereConditions::whereNotIn

public function whereNotIn(string|array $column, array $values): $this
Add a where not in condition with AND.

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  
Parameters
Parameter Type Description  
$column **string array**  
$values array    

ORM\QueryBuilder\HasWhereConditions::whereNotIn

↑ top