相关疑难解决方法(0)

TYPO3 - 调用另一个存储库

是否可以在不同的控制器中调用函数?我需要调用FindByCategoryGrouped($catId)designRepository.php和getCategories($catId)categoryRepository.php

public function listAction() {
    $this->settings['flexform']['showCategory'] ? $catId = $this->settings['flexform']['showCategory']:$catId = $this->settings['listView']['showCategory'];
    // print $catId;
    if (!$catId || $this->settings['flexform']['showCategory'] == '-1') {
        $designs = $this->designRepository->findAll(); 
    } else {
        // $designs = $this->designRepository->findByCategory($catId);
        $designs = $this->designRepository->findByCategoryGrouped($catId);  // THIS
        $categories = $this->categoryRepository->getCategories($catId); // THIS
    }
    // indhold forsvinder hvis næste linje slettes
    $this->view->assign('designs', $designs, "L", $GLOBALS['TSFE']->sys_language_uid);
    $this->view->assign('catId', $catId);
    $this->view->assign('categories', $categories);
}
Run Code Online (Sandbox Code Playgroud)

php typo3 fluid

4
推荐指数
1
解决办法
7024
查看次数

标签 统计

fluid ×1

php ×1

typo3 ×1