abstract class SQLFilter (View source)

The base class that user defined filters should extend.

Handles the setting and escaping of parameters.

Methods

__construct(EntityManager $em)

Constructs the SQLFilter object.

setParameter(string $name, string $value, string|null $type = null)

Sets a parameter that can be used by the filter.

string
getParameter(string $name)

Gets a parameter to use in a query.

string
__toString()

Returns as string representation of the SQLFilter parameters (the state).

string
addFilterConstraint(ClassMetadata $targetEntity, string $targetTableAlias)

Gets the SQL query part to add to a query.

Details

final __construct(EntityManager $em)

Constructs the SQLFilter object.

Parameters

EntityManager $em The entity manager.

final SQLFilter setParameter(string $name, string $value, string|null $type = null)

Sets a parameter that can be used by the filter.

Parameters

string $name Name of the parameter.
string $value Value of the parameter.
string|null $type The parameter type. If specified, the given value will be run through the type conversion of this type. This is usually not needed for strings and numeric types.

Return Value

SQLFilter The current SQL filter.

final string getParameter(string $name)

Gets a parameter to use in a query.

The function is responsible for the right output escaping to use the value in a query.

Parameters

string $name Name of the parameter.

Return Value

string The SQL escaped parameter to use in a query.

Exceptions

InvalidArgumentException

final string __toString()

Returns as string representation of the SQLFilter parameters (the state).

Return Value

string String representation of the SQLFilter.

abstract string addFilterConstraint(ClassMetadata $targetEntity, string $targetTableAlias)

Gets the SQL query part to add to a query.

Parameters

ClassMetadata $targetEntity
string $targetTableAlias

Return Value

string The constraint SQL if there is available, empty string otherwise.