I have an admin generator for the following model:
#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}
I looked at 2 pages corresponding to each table
php symfony doctrine:generate-admin backend Author
php symfony doctrine:generate-admin backend Book
Now I want the author to have a link to his books. What is the best way to do this? My attempt is a custom link that pre-selects filters, but I don't know how to do this.
config:
actions: ~
fields:
list:
display: [id, name, _booksLink]
filter: ~
form: ~
edit: ~
new: ~
and
<a href="<?= link_to('book?author_id='.$author->getId()) ?>">
See <?= $author->getName() ?> books
</a>
thank
source
share