0

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

Urs
  • 4,984
  • 7
  • 54
  • 116
  • 1
    'But when I do this, the URL is not built correctly.' what do you mean ? if param `tx_weiterbildung_pi1[item]` uses value of `original_uid` to build the link there should be not problem... disable RU for a moment and check if it doesn't use `uid` instead. – biesior Feb 25 '15 at 15:38
  • You nailed it! I hadn't been following your recipe on http://stackoverflow.com/questions/26142614/realurl-remove-controller-and-action-from-url when changing the values. I had to change the link in the list template as well: ``. Also, using , I was able to see that I had to pass that field name in camel case. I think that's it! – Urs Feb 25 '15 at 19:34
  • What I meant by 'URL ist not built correctly' was the fallback behaviour from RealURL, it received the item's uid from the original template (``), tried to match it with original_uid in the DB, failed and fell back to the uid of that item. – Urs Feb 25 '15 at 19:36
  • Ah - but I'm still getting an error. – Urs Feb 25 '15 at 19:47
  • ... Exception while property mapping at property path "":Object with identity "7064" not found. The number is the value that is stored in the field original_uid (Type INT in the database). The exception points to http://wiki.typo3.org/Exception/CMS/1297759968, where in the two posts on the bottom, it says something about allowing mapping of this property. @biesior, can you explain me how to do that? Or did I write the argument for `f:link.page` the wrong way? I first tried to pass it only {item.originalUid}, but then it complained it wanted an array – Urs Feb 25 '15 at 19:53
  • Extbase seems to receive the correct value that is stored in `original_uid`, but it's still looking it up in the `uid` column. How can I tell it to check another column? This seems to be related to https://review.typo3.org/#/c/2270/ – Urs Mar 02 '15 at 19:52
  • `$this->myRepo->findByUid(GeneralUtility::_GET('myParam'));` ? I'm AFK now... Don't forget to `intval()` it at least for basic validation – biesior Mar 02 '15 at 20:38
  • Sounds good, but I'm like totally blocked, sorry! I just don't understand how that stuff is supposed to work yet. You know, scary mvc.. :-) I've opened another question at http://stackoverflow.com/questions/28819223/in-extbase-how-to-access-item-by-another-value-than-uid with more examples – Urs Mar 02 '15 at 20:54

0 Answers0