Use other than primary key as RealURL id_field

倖福魔咒の 提交于 2019-12-20 07:29:47

问题


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}}">

来源:https://stackoverflow.com/questions/28720006/use-other-than-primary-key-as-realurl-id-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!