Zum Inhalt springen

Korrekte Methode für MM-Relation

Erstellt am 22. April 2011 · 2 Antworten · letzte Antwort am 23. April 2011

Tags: FlexForms, Datenbank, Frage

ChrL ·

Hi zusammen,

dies funktioniert:

$addwhere = 'AND doctype = '.$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'documentmaterial', 'Konfiguration');
$mm_cat = array(
	'table' => 'tx_dam_cat',
	'mmtable' => 'tx_himmat_text_category_mm',
	'catUidList' => $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'category', 'Konfiguration')
	);
$res = $this->pi_exec_query('tx_himmat_text',0,$addwhere,$mm_cat);

dies nicht:

$select = '*';
$local_table = 'tx_himmat_text';
$mm_table = 'tx_himmat_text_category_mm';
$foreign_table = 'tx_dam_cat';
$whereClause = ' AND tx_dam_cat.uid = '.$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'documentmaterial', 'Konfiguration');
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query($select, $local_table, $mm_table, $foreign_table);

Warum?
Sollte ich wirklich auf die zweite Methode verzichten?

MorphexX ·

Versuch bitte einmal

$whereClause = ' AND tx_dam_cat.uid IN (' . $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'category', 'Konfiguration') . ') ';

Inspired by http://api.typo3.org/typo3v4/current/html/class_8tslib__pibase_8php_source.html#l01158 ;-)

--

Um deinem obigen Beispiel näher zu kommen:

$addwhere = 'AND doctype = '.$this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'documentmaterial', 'Konfiguration');
$whereClause = ' AND tx_dam_cat.uid IN (' . $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'category', 'Konfiguration') . ') ' . $addwhere;