This documentation describes unreleased changes on the main branch.

StringField

Class. It extends Field.

use Saij\WpAppFramework\Query\Field\StringField;

A string field of a meta class (also #[PlainText], #[RichText] and #[Url]) or a string column of a table; compared without regard to case, like the default collations of the database.

Constructor

new StringField(string $class, string $field)
ParameterTypeDefaultDescription
classclass-stringrequiredThe class the field belongs to: a meta class (#[PostMeta]) or row class (#[Table]).
fieldstringrequiredThe name of the constructor parameter.

Methods

between()

between(string $min, string $max): Condition

Matches values from $min to $max, both included. Compared without regard to case.

ParameterTypeDefaultDescription
minstringrequiredThe lowest value in the order of the database.
maxstringrequiredThe highest value in the order of the database.

Returns Condition

contains()

contains(string $text): Condition

Matches values that contain $text, without regard to case.

ParameterTypeDefaultDescription
textstringrequiredThe text to search for; % and _ are matched literally.

Returns Condition

equals()

equals(string $value): Condition

Matches values equal to $value.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

getClass()

getClass(): string

The class the field belongs to.

Returns class-string

getField()

getField(): string

The name of the field: the name of the constructor parameter.

Returns string

greaterOrEqual()

greaterOrEqual(string $value): Condition

Matches values that sort after $value or are equal to it, without regard to case.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

greaterThan()

greaterThan(string $value): Condition

Matches values that sort after $value in the order of the database, without regard to case.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

in()

in(string ...$values): Condition

Matches values equal to one of $values. Throws an InvalidArgumentException if no value is given.

ParameterTypeDefaultDescription
...valuesstringThe values to compare with, without regard to case.

Returns Condition

lessOrEqual()

lessOrEqual(string $value): Condition

Matches values that sort before $value or are equal to it, without regard to case.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

lessThan()

lessThan(string $value): Condition

Matches values that sort before $value in the order of the database, without regard to case.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

notEquals()

notEquals(string $value): Condition

Matches values not equal to $value. On a nullable column, rows whose column is null match as well.

ParameterTypeDefaultDescription
valuestringrequiredThe value to compare with, without regard to case.

Returns Condition

notIn()

notIn(string ...$values): Condition

Matches values equal to none of $values. On a nullable column, rows whose column is null match as well. Throws an InvalidArgumentException if no value is given.

ParameterTypeDefaultDescription
...valuesstringThe values to compare with, without regard to case.

Returns Condition