[ Index ]

PHP Cross Reference of BuddyPress




/src/bp-xprofile/classes/ -> class-bp-xprofile-query.php (summary)

BuddyPress XProfile Classes.

File Size: 532 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BP_XProfile_Query:: (9 methods):

Class: BP_XProfile_Query  - X-Ref

Class for generating SQL clauses to filter a user query by xprofile data.

__construct( $xprofile_query )   X-Ref

param: array $xprofile_query {
since: 2.2.0

sanitize_query( $queries )   X-Ref
Ensure the `xprofile_query` argument passed to the class constructor is well-formed.

Eliminates empty items and ensures that a 'relation' is set.

param: array $queries Array of query clauses.
return: array Sanitized array of query clauses.
since: 2.2.0

is_first_order_clause( $query )   X-Ref
Determine whether a query clause is first-order.

A first-order query clause is one that has either a 'key' or a 'value' array key.

param: array $query XProfile query arguments.
return: bool  Whether the query clause is a first-order clause.
since: 2.2.0

get_cast_for_type( $type = '' )   X-Ref
Return the appropriate alias for the given field type if applicable.

param: string $type MySQL type to cast `value`.
return: string MySQL type.
since: 2.2.0

get_sql_clauses()   X-Ref
Generate SQL clauses to be appended to a main query.

Called by the public {@see BP_XProfile_Query::get_sql()}, this method is abstracted out to maintain parity
with WP's Query classes.

return: array {
since: 2.2.0

get_sql_for_query( &$query, $depth = 0 )   X-Ref
Generate SQL clauses for a single query array.

If nested subqueries are found, this method recurses the tree to produce the properly nested SQL.

param: array $query Query to parse. Passed by reference.
param: int   $depth Optional. Number of tree levels deep we currently are. Used to calculate indentation.
return: array {
since: 2.2.0

get_sql( $primary_table, $primary_id_column )   X-Ref
Generates SQL clauses to be appended to a main query.

param: string $primary_table     Database table where the object being filtered is stored (eg wp_users).
param: string $primary_id_column ID column for the filtered object in $primary_table.
return: array {
since: 2.2.0

get_sql_for_clause( &$clause, $parent_query )   X-Ref
Generate SQL JOIN and WHERE clauses for a first-order query clause.

"First-order" means that it's an array with a 'field' or 'value'.

param: array $clause       Query clause.
param: array $parent_query Parent query array.
return: array {
since: 2.2.0

find_compatible_table_alias( $clause, $parent_query )   X-Ref
Identify an existing table alias that is compatible with the current query clause.

We avoid unnecessary table joins by allowing each clause to look for an existing table alias that is
compatible with the query that it needs to perform. An existing alias is compatible if (a) it is a
sibling of $clause (ie, it's under the scope of the same relation), and (b) the combination of
operator and relation between the clauses allows for a shared table join. In the case of BP_XProfile_Query,
this * only applies to IN clauses that are connected by the relation OR.

param: array $clause       Query clause.
param: array $parent_query Parent query of $clause.
return: string|bool Table alias if found, otherwise false.
since: 2.2.0

Generated: Mon Jun 21 01:01:38 2021 Cross-referenced by PHPXref 0.7.1