RedBeanModelJoinTablesQueryAdapter Class Reference

Public Member Functions

 __construct ($modelClassName)
 addFromTableAndGetAliasName ($tableName, $onTableJoinIdName, $onTableAliasName=null, $tableJoinIdName= 'id')
 getAlreadyFromJoinedTableAliasName ($tableName)
 addLeftTableAndGetAliasName ($tableName, $onTableJoinIdName, $onTableAliasName=null, $tableJoinIdName= 'id', $extraOnQueryPart=null)
 getJoinFromQueryPart ()
 getJoinQueryPart ()
 getJoinWhereQueryPart ()
 getFromTableJoinCount ()
 getLeftTableJoinCount ()
 getFromTablesAndAliases ()
 getLeftTablesAndAliases ()
 isTableInFromTables ($tableName)
 getAliasByTableName ($tableName)
 getSelectDistinct ()
 setSelectDistinctToTrue ()

Protected Member Functions

 getAlreadyLeftJoinedTableAliasName ($tableName, $onTableAliasName, $onTableJoinIdName)

Detailed Description

Adapts join table information into query parts for a particular sql query. Automatically determines tables aliases and will provide sql for the from, join, and where query parts for join information.

Definition at line 41 of file RedBeanModelJoinTablesQueryAdapter.php.


Constructor & Destructor Documentation

__construct ( modelClassName  ) 
Parameters:
@modelClassName - the main 'from part' table is this model's table. This is considered the base table

Definition at line 61 of file RedBeanModelJoinTablesQueryAdapter.php.


Member Function Documentation

addFromTableAndGetAliasName ( tableName,
onTableJoinIdName,
onTableAliasName = null,
tableJoinIdName = 'id' 
)

Add a joining table by using a combination of an extra from table and a where clause.

Parameters:
$tableName - table to add in from clause.
$onTableJoinIdName - The joining id on the baseTable.

Definition at line 75 of file RedBeanModelJoinTablesQueryAdapter.php.

getAlreadyFromJoinedTableAliasName ( tableName  ) 

Since the from tables have to be unique tables (at least we think so) we can just pass the tableName to get the alias.

Parameters:
$tableName 
Returns:
null

Definition at line 104 of file RedBeanModelJoinTablesQueryAdapter.php.

addLeftTableAndGetAliasName ( tableName,
onTableJoinIdName,
onTableAliasName = null,
tableJoinIdName = 'id',
extraOnQueryPart = null 
)

Add a joining table by using a left join clause. If the table is already joined using the same onTableAliasName and onTableJoinIdName, then this join will be skipped.

Parameters:
$tableName - table to add as a left join clause
$onTableJoinIdName - The joining id on the baseTable.

Definition at line 122 of file RedBeanModelJoinTablesQueryAdapter.php.

getAlreadyLeftJoinedTableAliasName ( tableName,
onTableAliasName,
onTableJoinIdName 
) [protected]

Checks if the given tableName, onTableAliasName, and onTableJoinIdName is already left joined. If it is, then it returns the tableAliasName for the existing left join.

Returns:
- Existing tableAliasName or null.

Definition at line 158 of file RedBeanModelJoinTablesQueryAdapter.php.

getJoinFromQueryPart (  ) 
Returns:
- string SQL from part. This does not include the baseTable.

Definition at line 175 of file RedBeanModelJoinTablesQueryAdapter.php.

getJoinQueryPart (  ) 
Returns:
- string - left, inner, and right join clauses.

Definition at line 202 of file RedBeanModelJoinTablesQueryAdapter.php.

getJoinWhereQueryPart (  ) 
Returns:
- string - SQL where part that is used by the join clauses.

Definition at line 237 of file RedBeanModelJoinTablesQueryAdapter.php.

getFromTableJoinCount (  ) 
Returns:
integer count of from tables. Does not include base table

Definition at line 262 of file RedBeanModelJoinTablesQueryAdapter.php.

getLeftTableJoinCount (  ) 
Returns:
integer count of left join tables.

Definition at line 270 of file RedBeanModelJoinTablesQueryAdapter.php.

getFromTablesAndAliases (  ) 

For testing purposes.

Definition at line 278 of file RedBeanModelJoinTablesQueryAdapter.php.

getLeftTablesAndAliases (  ) 

For testing purposes.

Definition at line 286 of file RedBeanModelJoinTablesQueryAdapter.php.

isTableInFromTables ( tableName  ) 

Given a table name, is this table already in the list of tables to be joined in the from part of a query?

Definition at line 294 of file RedBeanModelJoinTablesQueryAdapter.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Mon Apr 24 07:10:29 2017