QBJoins
Last updated
Was this helpful?
Last updated
Was this helpful?
The QBJoins
class is a utility object designed to manage and configure all join operations in the QBSelect
query builder framework. It provides mechanisms to dynamically add, modify, and remove joins based on data sources, relations, or subqueries. This flexibility allows developers to construct queries that incorporate complex table relationships.
The class supports multiple join types, including INNER JOIN
and LEFT OUTER JOIN
, and offers tools to manage unused joins, ensuring optimized query execution. It also integrates with parent and root query references, allowing for scalable and modular query design.
For additional guidance on query construction and execution, see the .
Get query builder parent table clause, this may be a query or a join clause.
Get query builder parent.
Add a join clause from the parent query builder part to a derived table based on another query.
Add a join clause from the parent query builder part to a derived table based on another query.
Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.
Add a join with no alias for the joining table.
Add a join clause from the parent query builder part to the specified data source.
Add a join based on relation or add a manual join.
Remove the joins that are not used anywhere in the query.
Get query builder parent table clause, this may be a query or a join clause.
Sample
Get query builder parent.
Sample
Add a join clause from the parent query builder part to a derived table based on another query.
Parameters
Add a join clause from the parent query builder part to a derived table based on another query.
Parameters
Sample
Add a join with join type IQueryBuilderJoin#LEFT_OUTER_JOIN and no alias for the joining table.
Parameters
Sample
Add a join with no alias for the joining table.
Parameters
Sample
Add a join clause from the parent query builder part to the specified data source.
Parameters
Sample
Add a join based on relation or add a manual join. When dataSourceOrRelation is a relation name, a join will be added based on the relation. When dataSourceOrRelation is a data source, an empty join will be added with join type IQueryBuilderJoin#LEFT_OUTER_JOIN.
Parameters
Sample
Remove the joins that are not used anywhere in the query.
Parameters
Sample
Type the parent table clause for these joins.
Type the root query builder for these joins.
subqueryBuilder ;
joinType ;
Returns: a QBJoin object representing the join added for the specified subquery.
subqueryBuilder ;
joinType ;
alias ;
Returns: a QBJoin object representing the join added for the specified subquery with the given alias.
dataSource data source
Returns: a QBJoin object representing the newly added join with a default join type.
dataSource data source
joinType join type, one of QBJoin.LEFT_OUTER_JOIN, QBJoin.INNER_JOIN, QBJoin.RIGHT_OUTER_JOIN, QBJoin.FULL_JOIN
Returns: a QBJoin object representing the newly added join.
dataSource data source
joinType join type, one of IQueryBuilderJoin#LEFT_OUTER_JOIN, IQueryBuilderJoin#INNER_JOIN, IQueryBuilderJoin#RIGHT_OUTER_JOIN, IQueryBuilderJoin#FULL_JOIN
alias the alias for joining table
Returns: a QBJoin object representing the newly added join with the specified type and alias.
dataSourceOrRelation data source
alias the alias for joining table
Returns: a QBJoin object representing the newly added join using the given alias.
Returns: an array of QBJoin objects representing all joins in this query.
keepInnerjoins when true inner joins are not removed, inner joins may impact the query result, even when not used
Returns: this QBJoins instance after removing unused joins.