[ 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.
since: 2.2.0
return: array Sanitized array of query clauses.

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.
since: 2.2.0
return: bool  Whether the query clause is a first-order clause.

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`.
since: 2.2.0
return: string MySQL type.

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.

since: 2.2.0
return: array {

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.
since: 2.2.0
return: array {

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.
since: 2.2.0
return: array {

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.
since: 2.2.0
return: array {

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.
since: 2.2.0
return: string|bool Table alias if found, otherwise false.

Generated: Fri Jul 12 01:00:55 2024 Cross-referenced by PHPXref 0.7.1