just another orm...
View the Project on GitHub tflori/orm
» API Reference » ORM\Testing\EntityFetcherMock\Result
Extends: ORM\EntityFetcher
If you need more specific queries you write them yourself. If you need just more specific where clause you can pass them to the *where() methods.
Supported:
| Visibility | Name | Type | Description |
|---|---|---|---|
| public static | $defaultEntityManager |
ORM\EntityManager | The default EntityManager to use to for quoting |
public function __construct(
\ORM\EntityManager $entityManager,
\ORM\Entity|string $class,
)
| Parameter | Type | Description | |
|---|---|---|---|
$entityManager |
ORM\EntityManager | EntityManager where to store the fetched entities | |
$class |
**ORM\Entity | string** | Class to fetch |
ORM\Testing\EntityFetcherMock\Result::__construct
public function addEntities(\ORM\Entity[] $entities): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$entities |
ORM\Entity[] |
ORM\Testing\EntityFetcherMock\Result::addEntities
public function all(int $limit): \ORM\Entity[]
When no $limit is set it fetches all entities in result set.
| Returns | ORM\Entity[] |
| Parameter | Type | Description |
|---|---|---|
$limit |
int | Maximum number of entities to fetch |
ORM\Testing\EntityFetcherMock\Result::all
public function andParenthesis(): $this
| Returns | $this |
ORM\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::andWhere
public function close(
,
): \ORM\QueryBuilder\QueryBuilderInterface|\ORM\QueryBuilder\ParenthesisInterface
| Returns | ORM\QueryBuilder\QueryBuilderInterface|ORM\QueryBuilder\ParenthesisInterface |
ORM\Testing\EntityFetcherMock\Result::close
public function column(
mixed $column,
mixed $args = [],
mixed $alias = '',
): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$column |
mixed | Column or expression to fetch |
$args |
mixed | Arguments for expression |
$alias |
mixed | Alias for the column |
ORM\Testing\EntityFetcherMock\Result::column
public function columns(array $columns = null): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$columns |
array |
ORM\Testing\EntityFetcherMock\Result::columns
public function compare(\ORM\EntityFetcher $fetcher): int
Returns the score for the given EntityFetcher. The more conditions match the higher the score:
| Returns | int |
| Parameter | Type | Description |
|---|---|---|
$fetcher |
ORM\EntityFetcher |
ORM\Testing\EntityFetcherMock\Result::compare
public function count(): int
| Returns | int |
ORM\Testing\EntityFetcherMock\Result::count
public function createRelatedJoin(mixed $join, mixed $relation): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$join |
mixed | |
$relation |
mixed |
ORM\Testing\EntityFetcherMock\Result::createRelatedJoin
public function delete(): int
| Returns | int | The number of deleted rows |
ORM\Testing\EntityFetcherMock\Result::delete
public function filter(
string|\ORM\EntityFetcher\FilterInterface|callable $filter,
): $this
| Returns | $this |
| Parameter | Type | Description | ||
|---|---|---|---|---|
$filter |
**string | ORM\EntityFetcher\FilterInterface | callable** |
ORM\Testing\EntityFetcherMock\Result::filter
public function fullJoin(
mixed $class,
mixed $expression = '',
mixed $alias = '',
mixed $args = [],
): mixed
| Returns | mixed |
| Parameter | Type | Description |
|---|---|---|
$class |
mixed | |
$expression |
mixed | |
$alias |
mixed | |
$args |
mixed |
ORM\Testing\EntityFetcherMock\Result::fullJoin
public function getEntities(): \ORM\Entity[]
| Returns | ORM\Entity[] |
ORM\Testing\EntityFetcherMock\Result::getEntities
public function getEntityManager(): \ORM\EntityManager
| Returns | ORM\EntityManager |
ORM\Testing\EntityFetcherMock\Result::getEntityManager
public function getExpression(): string
| Returns | string |
ORM\Testing\EntityFetcherMock\Result::getExpression
public static function getGlobalFilters(string $class): array
A filter can be registered for the super class too.
| Static | This method is static. | |
| Returns | array |
| Parameter | Type | Description |
|---|---|---|
$class |
string |
ORM\Testing\EntityFetcherMock\Result::getGlobalFilters
public function getQuery(): string
| Returns | string |
ORM\Testing\EntityFetcherMock\Result::getQuery
public function groupBy(mixed $column, mixed $args = []): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$column |
mixed | Column or expression for groups |
$args |
mixed | Arguments for expression |
ORM\Testing\EntityFetcherMock\Result::groupBy
public function insert(array $rows): int
| Returns | int | The number of inserted rows |
| Parameter | Type | Description |
|---|---|---|
$rows |
array |
ORM\Testing\EntityFetcherMock\Result::insert
public function join(
mixed $class,
mixed $expression = '',
mixed $alias = '',
mixed $args = [],
): mixed
| Returns | mixed |
| Parameter | Type | Description |
|---|---|---|
$class |
mixed | |
$expression |
mixed | |
$alias |
mixed | |
$args |
mixed |
ORM\Testing\EntityFetcherMock\Result::join
public function joinRelated(mixed $relation): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$relation |
mixed |
ORM\Testing\EntityFetcherMock\Result::joinRelated
public function leftJoin(
mixed $class,
mixed $expression = '',
mixed $alias = '',
mixed $args = [],
): mixed
| Returns | mixed |
| Parameter | Type | Description |
|---|---|---|
$class |
mixed | |
$expression |
mixed | |
$alias |
mixed | |
$args |
mixed |
ORM\Testing\EntityFetcherMock\Result::leftJoin
public function leftJoinRelated(mixed $relation): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$relation |
mixed |
ORM\Testing\EntityFetcherMock\Result::leftJoinRelated
public function limit(mixed $limit): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$limit |
mixed | The limit to set |
ORM\Testing\EntityFetcherMock\Result::limit
public function matches(string $expression): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$expression |
string |
ORM\Testing\EntityFetcherMock\Result::matches
public function modifier(mixed $modifier): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$modifier |
mixed |
ORM\Testing\EntityFetcherMock\Result::modifier
public function offset(mixed $offset): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$offset |
mixed | The offset to set |
ORM\Testing\EntityFetcherMock\Result::offset
public function one(): \ORM\Entity
If there is no more entity in the result set it returns null.
| Returns | ORM\Entity |
ORM\Testing\EntityFetcherMock\Result::one
public function orderBy(
mixed $column,
mixed $direction = self::DIRECTION_ASCENDING,
mixed $args = [],
): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$column |
mixed | Column or expression for order |
$direction |
mixed | Direction (default: ASC) |
$args |
mixed | Arguments for expression |
ORM\Testing\EntityFetcherMock\Result::orderBy
public function orParenthesis(): $this
| Returns | $this |
ORM\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::orWhereNotIn
public function parenthesis(): $this
| Returns | $this |
ORM\Testing\EntityFetcherMock\Result::parenthesis
public static function registerGlobalFilter(
mixed $class,
string|\ORM\EntityFetcher\FilterInterface|callable $filter,
): mixed
A registered filter will be applied in all entity fetchers for the class if not excluded by
$fetcher->withoutFilter(Filter::class).
| Static | This method is static. | |
| Returns | mixed |
| Parameter | Type | Description | ||
|---|---|---|---|---|
$class |
mixed | |||
$filter |
**string | ORM\EntityFetcher\FilterInterface | callable** |
ORM\Testing\EntityFetcherMock\Result::registerGlobalFilter
public function reset(): $this
| Returns | $this |
ORM\Testing\EntityFetcherMock\Result::reset
public function rightJoin(
mixed $class,
mixed $expression = '',
mixed $alias = '',
mixed $args = [],
): mixed
| Returns | mixed |
| Parameter | Type | Description |
|---|---|---|
$class |
mixed | |
$expression |
mixed | |
$alias |
mixed | |
$args |
mixed |
ORM\Testing\EntityFetcherMock\Result::rightJoin
public function setFetchMode(
int $mode,
int|string|object $classNameObject = null,
array $constructorArgs = null,
): $this
Please note that this will execute the query - further modifications will not have any effect.
| Returns | $this |
| Parameter | Type | Description | ||
|---|---|---|---|---|
$mode |
int | one of the PDO::FETCH_ constants | ||
$classNameObject |
**int | string | object** | class (FETCH_CLASS), column number (FETCH_COLUMN), object (FETCH_INTO) |
$constructorArgs |
array | arguments to pass to the constructor (FETCH_CLASS) |
See Also:
ORM\Testing\EntityFetcherMock\Result::setFetchMode
public function setQuery(
string|\ORM\QueryBuilder\QueryBuilderInterface $query,
array $args = null,
): $this
For easier use and against sql injection it allows question mark placeholders.
Please be aware that this query is not touched at all and neither filters nor where conditions are applied.
| Returns | $this |
| Parameter | Type | Description | |
|---|---|---|---|
$query |
**string | ORM\QueryBuilder\QueryBuilderInterface** | Raw query string or a QueryBuilderInterface |
$args |
array | The arguments for placeholders |
ORM\Testing\EntityFetcherMock\Result::setQuery
public function update(array $updates): int
NOTE: not all drivers support UPDATE with JOIN (or FROM). Has to be implemented in the database abstraction layer.
$updates should be an array which columns to update with what value. Use expressions to bypass escaping.
| Returns | int | The number of affected rows |
| Parameter | Type | Description |
|---|---|---|
$updates |
array | An array of columns to update |
ORM\Testing\EntityFetcherMock\Result::update
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\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::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\Testing\EntityFetcherMock\Result::whereNotIn
public function with(string $relations): $this
The relations are only loaded after you execute ->all()
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$relations |
string |
ORM\Testing\EntityFetcherMock\Result::with
public function withoutFilter(string $filterClass): $this
| Returns | $this |
| Parameter | Type | Description |
|---|---|---|
$filterClass |
string |
ORM\Testing\EntityFetcherMock\Result::withoutFilter