Use other than primary key as RealURL id_field

2019-03-06 04:52发布

问题:

In a TYPO3 6.2 site, I have the following postVarSetsin realurl_conf.php for an extbase extension:

     'postVarSets' => array(
        '_DEFAULT' => array(
            'wba' => array(
                array(
                    'GETvar' => 'tx_weiterbildung_pi1[item]' ,
                    'lookUpTable' => array(
                        'table' => 'tx_weiterbildung_domain_model_item',
                        'id_field' => 'uid',
                        'alias_field' => 'kurs_titel',
                        'addWhereClause' => ' AND NOT deleted',
                        'useUniqueCache' => 1,
                        'useUniqueCache_conf' => array(
                            'strtolower' => 1,
                            'spaceCharacter' => '-',
                        ),
                    ),
                ),
            ),
        ),
    ),

This works.

As the data in this table is imported from another site, I realized that to avoid confusion, I have to resolve the URL via another field (that contains the entry's original uid):

'id_field' => 'original_uid'

But when I do this, the URL is not built correctly.

So: is it possible to use non primary fields as id_field in RealURL? How?

If not, what strategy would you recommend?

Upon import, (if extbase allows that) I could also force the value of original_uid into uid, would that be bad practice? Or make original_uid the primary key, leaving AUTO_INCREMENT with uid?

EDIT: the issue was different, I forgot to modify the list template, see comments below.

Instead of

<f:link.page additionalParams="{tx_weiterbildung_pi1 :{item : item}}">

the link in the template had to receive the replaced param:

<f:link.page additionalParams="{tx_weiterbildung_pi1 :{item : item.originalUid}}">