TYPO3 - 具有QueryBuilder的Extbase自定义查询:如何向url添加action show以使链接再次工作

时间:2017-08-24 16:07:27

标签: typo3 typo3-extensions typo3-8.x

当我运行此查询时...我的列表视图中的链接中没有显示操作......并且它们不再起作用了:

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);
}

控制台:

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

当我调试它时,我可以看到我呈现以下数组:

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

如何让链接再次运行?

1 个答案:

答案 0 :(得分:1)

更改

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

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

因为您不再获取对象而是数据库行数组。 此外,您的listAction缺少参数$ minUid和$ maxUid。