Philipp M
Philipp M

Reputation: 3498

TYPO3 - Extbase Custom query w/ QueryBuilder: How to add action show to url for links to work again

When run I this query ... there is no show action in the links in my list view ... and they do not work anymore:

Controller.php

$uid = 10;
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$statement = $queryBuilder  
    ->select('uid', 'pid', 'header')            
    ->from('tt_content')
    ->where(
       $queryBuilder->expr()->eq('uid', $uid)
    )           
    ->execute();    
while ($row = $statement->fetchAll()) {
    $this->view->assign('inet', $row);
}

Console:

<tr id="2">
    <td>2</td>
    <td class="name"><a href="code/?tx_code_code%5Brecord%5D%5Buid%5D=2&amp;tx_code_code%5Brecord%5D%5Bcode%5D=25490004X&amp;tx_code_code%5Brecord%5D%5Bname%5D=Company%20Name%20Inc&amp;cHash=e8e3573028618746234">Company Name Inc</a></td>
</tr>

When I debug it I can see that I render the following array:

array(20 items)
   0 => array(3 items)
      uid => 1 (integer)
      code => '213800' (6 chars)
      name => 'Company Name Inc' (16 chars)

How can I get the links to work again?

Upvotes: 0

Views: 463

Answers (1)

stressedout
stressedout

Reputation: 28

change

<f:link.action action="show" pageUid="43" arguments="{record:record}">{record.name}</f:link.action>

to

<f:link.action action="show" pageUid="43" arguments="{record:record.uid}">{record.name}</f:link.action>

because you ain't getting Objects anymore but arrays of database rows. Additionally your listAction is missing the parameters $minUid and $maxUid.

Upvotes: 1

Related Questions