Typo3 在自己的viewhelper中使用外部模型作为参数

Typo3 在自己的viewhelper中使用外部模型作为参数,typo3,view-helpers,Typo3,View Helpers,从fluid中,我调用viewhelper类 {adr}是tt_地址的数组→ FriendsOfTYPO3\tAddress\Domain\Model\Address 在viewhelper中,我注册参数 use FriendsOfTYPO3\TtAddress\Domain\Model\Address; public function initializeArguments() { $this->registerArgument('adr', 'Frien

从fluid中,我调用viewhelper类 {adr}是tt_地址的数组→ FriendsOfTYPO3\tAddress\Domain\Model\Address

在viewhelper中,我注册参数

    use FriendsOfTYPO3\TtAddress\Domain\Model\Address;
    public function initializeArguments() {
        $this->registerArgument('adr', 'FriendsOfTYPO3\TtAddress\Domain\Model\Address', 'the addresses', true);
    }
此操作失败,并显示以下消息: 参数“adr”的注册类型为“FriendsOfTYPO3\TtAddress\Domain\Model\Address”,但在视图帮助程序中为“TYPO3\CMS\Extbase\Persistence\Generic\QueryResult”类型

如何接收要使用的adr阵列。
谢谢你的帮助

如果VH必须接受多个地址,则ViewHelper参数不得将查询结果中包含的任何对象的类名注册为数据类型


相反,您必须在控制器中注册类型为
TYPO3\CMS\Extbase\Persistence\Generic\QueryResult

的参数,您可以将地址作为数组传递给视图:
$this->view->assign('adr',$address->toArray())。我在没有控制器的情况下尝试此操作。只是一个viewhelper和tt_地址模板。我试图采用“use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;”的帮助,但尝试失败。我缺少什么类?那么您必须接受
\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
作为viewhelper中的参数:
$this->registerArgument('adr',TYPO3\CMS\Extbase\Persistence\Generic\QueryResult',the addresses',true);}如果需要,可以将对象转换为数组,然后再转换。