[TYPO3-mvc] Last question today: MM query

Susanne Moog typo3 at susannemoog.de
Mon Jun 1 16:32:46 CEST 2009


Hello again :-)

I promise this really is the last question for today. I have written the
following function to get my MM query working and wanted to know if
there already is an extbase/fluid wrapper for such a query:

public function findWithGroups($groups, $limit=NULL, $sortBy='last_name') {

	$select = 'tx_addresses_domain_model_address.uid';
	$local_table = 'tx_addresses_domain_model_address';
	$mm_table = 'tx_addresses_address_addressgroup_mm';
	$foreign_table = 'tx_addresses_domain_model_addressgroup';
	$whereClause = 'AND tx_addresses_domain_model_addressgroup.uid IN (' .
$groups . ')';
		
	$res =
$GLOBALS['TYPO3_DB']->exec_SELECT_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause,'',$sortBy,$limit);

		
	$rows = Array();
	while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		$rows[] = $row['uid'];	
	}
	$foundAddressesList = implode(',', $rows);
	return $this->findWhere('uid IN (' . $foundAddressesList . ')', '',
$sortBy);
}


Thanks!

Susanne

-- 
Susanne Moog
NEUSTA GmbH - www.neusta.de


More information about the TYPO3-project-typo3v4mvc mailing list