Symfony管理员生成器,链接到过滤结果
|
我有以下模型的管理员生成器:
#schema.yml
Author:
columns:
name: { type: string(255), notnull: true }
Book:
columns:
authorId: { type: integer, notnull: true }
title: { type: string(512), notnull: true }
content: { type: string(512), notnull: true }
relations:
Author: { onDelete: CASCADE, local: authorId, foreign: id, foreignAlias: Books}
我整理了2页,每张桌子都对应了
php symfony doctrine:generate-admin backend Author
php symfony doctrine:generate-admin backend Book
现在我想在作者视图中查看他的书的链接。
最好的方法是什么?
我的尝试是一个预选过滤器的自定义链接,但我不知道该怎么做。
#generator.yml for Author
# ...
config:
actions: ~
fields:
list:
display: [id, name, _booksLink]
filter: ~
form: ~
edit: ~
new: ~
和
<!-- modules/author/templates/_booksLink.php -->
<a href=\"<?= link_to(\'book?author_id=\'.$author->getId()) ?>\"><!-- how to select filter? -->
See <?= $author->getName() ?> books
</a>
谢谢
没有找到相关结果
已邀请:
1 个回复
硕歌沙
关于大小写的注意事项:字段名称与架构中定义的大小写匹配。例如:如果架构中有
,则必须在上面的函数(第5行)中写入
。如果架构中有“ 7”,则必须在函数中编写“ 7”。另外,模块名称总是带小写的下划线(例如:
)。 在您的generator.yml中