[TYPO3-dev] Complex mm-relations

JoH asenau info at cybercraft.de
Wed Jun 3 19:43:11 CEST 2009


>>> i have a master table having 4 mm-relation fields in. All share one
>>> mm-table.
>>>
>>> Now when building queries, i recognized that the mm-query doesn't
>>> work with this configuration: it doesn't use "tablenames" field in
>>> mm-table, so even if i use it for one-field-relation i get wrong
>>> results.
>>
>> How do you build the queries?
>> Using lots of mm_relations to different tables didn't seem to be a
>> problem for me so far, since we are using it quite often within the
>> tagpack extension.
>>
>
> i try to use the API when ever possible. But this seems to be
> impossible here. Do you use different mm-table for each relation?

We are using a group field within the tagpack TCA:

  'relations' => Array (
      'exclude' => 1,
      'label' =>
'LLL:EXT:tagpack/locallang_db.xml:tx_tagpack_tags.relations',
      'config' => Array (
   'type' => 'group',
   'internal_type' => 'db',
   'allowed' => '*',
   'prepend_tname' => 1,
   'size' => 8,
   'minitems' => 0,
   'maxitems' => 999999999,
   'MM' => 'tx_tagpack_tags_relations_mm',
      )
  ),

Whenever a table is marked as "taggable" the form field is virtually
generated at runtime based on the nearly the same settings. So depending on
the user settings the MM table contains relations from tags to records
located in lots of different tables.

As far as I can see, the only MM related functions making use of
"tablenames" are not within class.t3lib_db.php but within
class.t3lib_loaddbgroup.php (readMM and writeMM)
This might be the reason why it works for the tagpack while working in the
BE, since the type of the field is "group" and not "select".
FE is handled completely by exec_SELECTgetRows and a manual inclusion of the
"tablenames" feature - so again we don't run into problems.

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Twitter: http://twitter.com/bunnyfield
Xing: http://contact.cybercraft.de
T3 cookbook (2nd edition): http://www.4any1.de
TYPO3 Schulung: http://workshops.eqony.com






More information about the TYPO3-dev mailing list