Skip to content
Advertisement

How to create dropdown select in Symfony easy admin crud panel?

I am new in Symfony. I have relation tables such as authors, books and book_authors. One book can have many authors and one author can have many books. So, here is my tables:

enter image description here

And now, I am trying to implement crud controller with easy admin extension.

JavaScript

And

JavaScript

But in BookAuthorsCrudController I have a problems:

JavaScript

I can’t use book_id and author_id to implement search function. Only book and author as it realised in BookAuthor Entity:

JavaScript

Help me please!

Advertisement

Answer

Use dots to search in Doctrine associations for the search.

(e.g. ‘book.id’ or ‘author.id’) instead of book_id or author_id.

Or implement __toString() method in Book and Author.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement