exec_SELECT_mm_query()¶
What does it do?¶
The method executes a SQL-Select statement and returns a mysql ressource.
Header¶
/**
* Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined
* Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation.
* The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local / [$mm_table].uid_foreign <--> [$foreign_table].uid
* The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $GLOBALS['TCA'] in Inside TYPO3 for more details.
*
* @param string $select Field list for SELECT
* @param string $local_table Tablename, local table
* @param string $mm_table Tablename, relation table
* @param string $foreign_table Tablename, foreign table
* @param string $whereClause Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! You have to prepend 'AND ' to this parameter yourself!
* @param string $groupBy Optional GROUP BY field(s), if none, supply blank string.
* @param string $orderBy Optional ORDER BY field(s), if none, supply blank string.
* @param string $limit Optional LIMIT value ([begin,]max), if none, supply blank string.
* @return bool|\mysqli_result|object MySQLi result object / DBAL object
* @see exec_SELECTquery()
*/
public static function exec_SELECT_mm_query( $select, $local_table, $mm_table, $foreign_table, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '' )
Sample¶
$res = \Netzmacher\Refresh\Compatibility\Core\Database\DatabaseConnection::exec_SELECT_mm_query( $select, $local_table, $mm_table, $foreign_table, $whereClause, $groupBy );
Refresh¶
You can refresh your extension by find and replace.
// Code from TYPO3 6.2 to 8.7
$query = $GLOBALS[ 'TYPO3_DB' ]->exec_SELECT_mm_query( $select, $local_table, $mm_table, $foreign_table, $whereClause, $groupBy );
// Code from TYPO3 6.2 to 9.x
$res = \Netzmacher\Refresh\Compatibility\Core\Database\DatabaseConnection::exec_SELECT_mm_query( $select, $local_table, $mm_table, $foreign_table, $whereClause, $groupBy );
Move “$GLOBALS[ ‘TYPO3_DB’ ]->exec_SELECT_mm_query” to “Netzmacher\Refresh\Compatibility\Core\Database\DatabaseConnection::exec_SELECT_mm_query”