Query
class Query
Constants
BOOLEAN_AND |
|
BOOLEAN_OR |
|
SORT_ASCENDING |
|
SORT_DESCENDING |
|
RETURN_FULL_QUERY |
|
RETURN_WHERE |
|
Methods
Query constructor.
Returns a String representation (SQL Query String) - depending on the defaultStringReturn setting this may be the whole SQL or only the WHERE condition SQL
Clears all scopes and conditions
Escapes the passed mysql fieldname with backticks
Escapes the passed value for using it in a mysql query
Returns the full SQL string for this Query
Return Limit
Return ORDER BY part of the query
Returns an array with all defined Conditions
Returns an array with all defined Conditions
Checks if a condition for the specified field is specified NOTE: This check does not (yet) cover whereRaw() conditions with custom syntaxes
Builds the WHERE Condition SQL
Set Limit on Query
Always evaluates the scope to FALSE and can be used to force returning an empty collection in some filter conditions
Adds a orderBy condition to the Query
Resets orderBy condition of the Query
Sets the default return if Object is converted to a STRING
Registeres a Callback which is executed if the Query is being changed
Syntax-Helper to start a query with for a table. Use as Query::table('myTable')->where('field1','=','val');
Trigger onChange event callbacks
Unscope Function to remove specific scopes of the query
Removes all scope conditions which are set in the passed Query object (similar to boolean subtract)
Removes all Where Conditions or the Conditions for a specific field
Adds a custom WHERE Condition to the query
Adds a EQUAL WHERE Condition to the query
Applies all WHERE conditions of the passed Query object to the current query (Copy)
Adds a custom NEGATED WHERE Condition to the query
Adds a NEGATED EQUAL WHERE Condition to the query
Details
at line 58
__construct(string $table)
Query constructor.
at line 389
string
__toString()
Returns a String representation (SQL Query String) - depending on the defaultStringReturn setting this may be the whole SQL or only the WHERE condition SQL
at line 305
void
clear()
Clears all scopes and conditions
at line 499
static string
escapeField($field)
Escapes the passed mysql fieldname with backticks
at line 509
static string
escapeValue($value)
Escapes the passed value for using it in a mysql query
at line 381
string
getSQL()
Returns the full SQL string for this Query
at line 433
array
getScopeLimit()
Return Limit
at line 421
string
getScopeOrderBy()
Return ORDER BY part of the query
at line 406
Condition[]
getScopeWhere()
Returns an array with all defined Conditions
at line 413
ConditionGroup[]
getScopeWhereGroup()
Returns an array with all defined Conditions
at line 445
array
getWhereConditionsForField($field)
Checks if a condition for the specified field is specified NOTE: This check does not (yet) cover whereRaw() conditions with custom syntaxes
at line 455
string
getWhereSQL()
Builds the WHERE Condition SQL
at line 263
Query
groupBy($field)
Add a group by condition to the Query
at line 216
$this
limit(int $length, int $offset = 0)
Set Limit on Query
at line 252
Query
none()
Always evaluates the scope to FALSE and can be used to force returning an empty collection in some filter conditions
at line 230
Query
or(callable|null $callback = null)
Chain the next where() call with OR
at line 286
Query
orderBy(string $field, string $sortDirection = self::SORT_ASCENDING)
Adds a orderBy condition to the Query
at line 274
Query
resetOrderBy()
Resets orderBy condition of the Query
at line 113
Query
select(string $selectField)
Adds a SELECT field to the query
at line 89
void
setDefaultStringReturn($returnType)
Sets the default return if Object is converted to a STRING
at line 69
void
setOnChangeCallback(callable $callback)
Registeres a Callback which is executed if the Query is being changed
at line 104
static Query
table(string $table)
Syntax-Helper to start a query with for a table. Use as Query::table('myTable')->where('field1','=','val');
at line 77
void
triggerOnChange()
Trigger onChange event callbacks
at line 321
$this
unscope(string $what = 'all')
Unscope Function to remove specific scopes of the query
at line 358
void
unscopeFromQuery(Query $Query)
Removes all scope conditions which are set in the passed Query object (similar to boolean subtract)
at line 343
unscopeWhere($unscopeSpecificField = false)
Removes all Where Conditions or the Conditions for a specific field
at line 126
Query
where(string $field, string $condition, string $value = null)
Adds a custom WHERE Condition to the query
at line 151
Query
whereEqual(string $field, string $value)
Adds a EQUAL WHERE Condition to the query
at line 200
Query
whereFromQuery(Query $query)
Applies all WHERE conditions of the passed Query object to the current query (Copy)
at line 139
Query
whereNot(string $field, string $condition, string $value = null)
Adds a custom NEGATED WHERE Condition to the query
at line 163
Query
whereNotEqual(string $field, string $value)
Adds a NEGATED EQUAL WHERE Condition to the query
at line 177
Query
whereRaw($rawSQL)
Adds a RAW WHERE Condition to the query