Answer the question
In order to leave comments, you need to log in
How to implement tags for multiple entities in SonataAdminBundle?
I have several entities in SonataAdminBundle (Question, Article, News) that I need to attach tags to. Made with the help of Many-To-Many connections with Tag in each of the necessary entities. But for this I had to create several intermediate tables, which is inconvenient. I found the FPNTagBundle
bundle , which allows you to set an intermediate table with an additional ResourceType field. This is exactly what is needed, I did exactly this myself once in another project.
But FPNTagBundle binds through a separate TagManager, and does not work in SonataAdmin.
What do you suggest? How were such tasks implemented?
Maybe not to take a steam bath, and leave a few intermediate tables? True, I will still have five entities for tagging ... And I'm afraid that searching by tags for all tagged entities will not be easy - you will need to run through several relationship tables.
I even started to make a custom FormFieldType, but I didn’t master it right away, somehow everything is confusing there. Maybe I will. If anyone has experience in creating custom handlers for fields in Sonata - let me know.
Answer the question
In order to leave comments, you need to log in
The solution to the problem was found in Saving hooks . Here is an article where I described the solution:
Implementing a tagging system in the admin panel with the Sonat bundle...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question