下面的代码books
是book
包含某些属性的对象列表。通过点击标题,它会进入一个动作display
流体模板是
<f:for each="books" as="book">
<f:link.action action="display" arguments="{book: book}"> {book.title} </f:link.action>
</f:for>
在控制器中
public function displayAction(){
print_r($this->request->getArguments());
}
这里的书的价值没有被设定。[书] => 空。我尝试打印它的类,它仍然给我null。
当我将参数发送为book.title instead of the entire object
我在这里想念什么?这是将对象作为参数传递的正确方法吗?
编辑:
最初我尝试过这种方式。
public function displayAction(\TYPO3\MyExt\Domain\Model\Book $book) {}
但这给了我
Exception while property mapping at property path "":No converter found which can be used to convert from "string" to "TYPO3\MyExt\Domain\Model\Book"
Book 类是我手动创建的,没有在扩展生成器下注册。