PHP Class Piwik\DataAccess\LogQueryBuilder\JoinGenerator

Exibir arquivo Open project: piwik/piwik Class Usage Examples

Protected Properties

Property Type Description
$tables JoinTables

Public Methods

Method Description
__construct ( JoinTables $tables )
generate ( ) : array Generate the join sql based on the needed tables
getJoinString ( )
shouldJoinWithSelect ( )
sortTablesForJoin ( $tA, $tB )

Protected Methods

Method Description
findJoinCriteriasForTables ( Piwik\Tracker\LogTable $logTable, Piwik\Tracker\LogTable[] $availableLogTables ) : string | null
generateNonVisitJoins ( $tableName, $tableNameToJoin, $index ) This code is a bit tricky. We have to execute this right at the beginning before actually iterating over all the tables and generating the join string as we may have to delete a table from the tables. If we did not delete this table upfront, we would have maybe already added a joinString for that table, even though it will be later removed by another table. This means if we wouldn't delete/unset that table upfront, we would need to alter an already generated join string which would not be really nice code as well.

Private Methods

Method Description
addMissingTablesNeededForJoins ( )

Method Details

__construct() public method

public __construct ( JoinTables $tables )
$tables JoinTables

findJoinCriteriasForTables() protected method

protected findJoinCriteriasForTables ( Piwik\Tracker\LogTable $logTable, Piwik\Tracker\LogTable[] $availableLogTables ) : string | null
$logTable Piwik\Tracker\LogTable
$availableLogTables Piwik\Tracker\LogTable[]
return string | null returns null in case the table is already joined, or the join string if the table needs to be joined

generate() public method

Generate the join sql based on the needed tables
public generate ( ) : array
return array

generateNonVisitJoins() protected method

Next problem is, because we are deleting a table, we have to remember the "joinOn" string for that table in a property "nonVisitJoins". Otherwise we would not be able to generate the correct "joinOn" string when actually iterating over all the tables to generate that string.
protected generateNonVisitJoins ( $tableName, $tableNameToJoin, $index )
$tableName
$tableNameToJoin
$index

getJoinString() public method

public getJoinString ( )

shouldJoinWithSelect() public method

sortTablesForJoin() public method

public sortTablesForJoin ( $tA, $tB )

Property Details

$tables protected_oe property

protected JoinTables,Piwik\DataAccess\LogQueryBuilder $tables
return JoinTables