abstract class BsonFilter (View source)

The base class that user defined filters should extend.

Handles the setting and escaping of parameters.

Properties

protected DocumentManager $dm The document manager.
protected array $parameters Parameters for the filter.

Methods

__construct(DocumentManager $dm)

Constructs the BsonFilter object.

setParameter(string $name, mixed $value)

Sets a parameter that can be used by the filter.

mixed
getParameter(string $name)

Gets a parameter to use in a query.

array
addFilterCriteria(ClassMetadata $class)

Gets the criteria array to add to a query.

Details

final __construct(DocumentManager $dm)

Constructs the BsonFilter object.

Parameters

DocumentManager $dm The Document Manager

final BsonFilter setParameter(string $name, mixed $value)

Sets a parameter that can be used by the filter.

Parameters

string $name Name of the parameter.
mixed $value Value of the parameter.

Return Value

BsonFilter The current Bson filter.

final mixed getParameter(string $name)

Gets a parameter to use in a query.

These are not like SQL parameters. These parameters can hold anything, even objects. They are not automatically injected into a query, they are to be used in the addFilterCriteria method.

Parameters

string $name Name of the parameter.

Return Value

mixed The parameter.

abstract array addFilterCriteria(ClassMetadata $class)

Gets the criteria array to add to a query.

If there is no criteria for the class, an empty array should be returned.

Parameters

ClassMetadata $class

Return Value

array