Question

I'm using RealURL on a site where I would like to join two tables in the "lookUpTable" statement. The resulting URL should be a combination of fields in table a and table b.

So basically I would like to do a JOIN in table and addWhereClause and than use multiple alias_fields.

The standard syntax is:

'lookUpTable' => array(
                            'table' => 'user_3dsplmxml_bfsbrand',
                            'id_field' => 'xml_id',
                            'alias_field' => 'xml_title',
                            'maxLength' => 10,
                            'addWhereClause' => ' AND NOT deleted'
                        )

The manual gives no hint if this is possible, but it would be of great use. Anyone knows if this can be done?

Was it helpful?

Solution

You can use a userFunc instead of the lookUpTable.

See realurl manual

OTHER TIPS

This worked for me (TYPO3 6.1.7):

   'veranstaltung' => array(
      array(
        'GETvar' => 'tx_wsevents_wsevents[dates]',
        'lookUpTable' => array(
          'table' => 'tx_wsevents_domain_model_dates dates, tx_wsevents_domain_model_events events',
          'id_field' => 'dates.uid',
          'alias_field' => "CONCAT ( events.name, '_', DATE_FORMAT ( from_unixtime ( dates.startdate ),'%d-%m-%Y') )",
          'addWhereClause' => ' AND NOT dates.deleted AND ' . 'dates.events=events.uid',
          'useUniqueCache' => 1,
          'useUniqueCache_conf' => array(
            'strtolower' => 1,
            'spaceCharacter' => '-'
          )
        )
      )
    ),

I needed to use a subquery. The mentioned way with 'table' => 'tableA a, tableB b' did not return any value.

                    'lookUpTable' => array(
                        'table'               => '(
                                SELECT
                                    i.uid, k.objektart
                                FROM
                                    tx_wib24immobilien_domain_model_immobilie i
                                    JOIN
                                            tx_wib24immobilien_domain_model_objektkategorie k
                                        ON
                                            i.objektkategorie = k.uid
                            ) i',
                        'id_field'            => 'uid',
                        'alias_field'         => 'objektart',
                        ...
                    ),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top