Agg
extends ContractBuilder
in package
Aggregate functions for the PORM library.
These methods are used to perform aggregate functions on the CDatabase.
Tags
Table of Contents
Properties
- $aggregated : array<string|int, mixed>
Methods
- avg() : Agg
- Get the average value of a column and assing it to columnName
- between() : $this
- Checks if the value of the $columnName is between the given values.
- build() : array<string|int, mixed>
- builder() : static
- columnsCompare() : static
- This compares two tables in the db
- div() : Agg
- divide the column value
- eq() : Agg
- Equal to.
- gt() : Agg
- Greater than.
- gte() : Agg
- Greater than or equal to.
- jsonified() : Agg
- json encode the column value and assign it to the column
- like() : Agg
- Used to add a like condition to a query
- lt() : Agg
- Less than.
- lte() : Agg
- Less than or equal to.
- max() : Agg
- Get the maximum value of a column
- minus() : Agg
- subtract from the column value
- neq() : Agg
- Not equal to.
- notBetween() : $this
- Checks if the value of the $columnName is not between the given values.
- notLike() : Agg
- Used to add a like condition to a query
- now() : Agg
- Assign current timestamp to a column
- of() : Agg
- multiply the column value
- plus() : Agg
- add to the column value
- random() : Agg
- Assign a random value to a column
- regex() : $this
- Check if the value of the given column matches the given regular expression
- sum() : Agg
- Get the sum of a column and assign it to columnName
- uuid() : Agg
- If uuid string is passed, checks if a column is matching the given uuid otherwise generates new one and assigns it to the column given
Properties
$aggregated
private
array<string|int, mixed>
$aggregated
= []
Methods
avg()
Get the average value of a column and assing it to columnName
public
avg(string $columName, string $column) : Agg
Parameters
- $columName : string
- $column : string
-
will be the column to get the minimum value from
Return values
Aggbetween()
Checks if the value of the $columnName is between the given values.
public
between( $columnName, array<string|int, mixed> $values) : $this
Cool for all number formats and dates
Parameters
Tags
Return values
$thisbuild()
public
build() : array<string|int, mixed>
Return values
array<string|int, mixed>builder()
public
static builder(mixed ...$args) : static
Parameters
- $args : mixed
Return values
staticcolumnsCompare()
This compares two tables in the db
public
columnsCompare(string $column, string $comparison, string $otherColumn) : static
Parameters
- $column : string
- $comparison : string
- $otherColumn : string
Tags
Return values
staticdiv()
divide the column value
public
div(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Aggeq()
Equal to.
public
eq(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Agggt()
Greater than.
public
gt(string $columnName, int $value) : Agg
Parameters
- $columnName : string
- $value : int
Return values
Agggte()
Greater than or equal to.
public
gte(string $columnName, int $value) : Agg
Parameters
- $columnName : string
- $value : int
Return values
Aggjsonified()
json encode the column value and assign it to the column
public
jsonified(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Agglike()
Used to add a like condition to a query
public
like(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Agglt()
Less than.
public
lt(string $columnName, int $value) : Agg
Parameters
- $columnName : string
- $value : int
Return values
Agglte()
Less than or equal to.
public
lte(string $columnName, int $value) : Agg
Parameters
- $columnName : string
- $value : int
Return values
Aggmax()
Get the maximum value of a column
public
max(string $columnName, string $column) : Agg
Parameters
- $columnName : string
-
will be the alias of the result
- $column : string
-
will be the column to get the maximum value from
Return values
Aggminus()
subtract from the column value
public
minus(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Aggneq()
Not equal to.
public
neq(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
AggnotBetween()
Checks if the value of the $columnName is not between the given values.
public
notBetween( $columnName, array<string|int, mixed> $values) : $this
Cool for all number formats and dates too
Parameters
Tags
Return values
$thisnotLike()
Used to add a like condition to a query
public
notLike(string $columnName, string|array<string|int, mixed> $value) : Agg
Parameters
- $columnName : string
- $value : string|array<string|int, mixed>
Return values
Aggnow()
Assign current timestamp to a column
public
now(string $columName) : Agg
Parameters
- $columName : string
-
The column to assign the current timestamp to
Return values
Aggof()
multiply the column value
public
of(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Aggplus()
add to the column value
public
plus(string $columnName, mixed $value) : Agg
Parameters
- $columnName : string
- $value : mixed
Return values
Aggrandom()
Assign a random value to a column
public
random(string $columnName) : Agg
Parameters
- $columnName : string
-
will be the alias of the result
Return values
Aggregex()
Check if the value of the given column matches the given regular expression
public
regex( $columnName, string $regex) : $this
Parameters
Return values
$thissum()
Get the sum of a column and assign it to columnName
public
sum(string $columName, string $column) : Agg
Parameters
- $columName : string
-
will be the alias of the result
- $column : string
-
will be the column to get the minimum value from
Return values
Agguuid()
If uuid string is passed, checks if a column is matching the given uuid otherwise generates new one and assigns it to the column given
public
uuid(string $columnName, string|null $uuidString) : Agg
Parameters
- $columnName : string
- $uuidString : string|null
-
optional