G
G
grabbee2018-03-23 14:21:23
symfony
grabbee, 2018-03-23 14:21:23

How to save tags to something?

For example, goods are stored in one table. You can then add a tag to each. There is a separate table for tags. For communication product tags the third table. During post-moderation, you need to remove a certain tag.
* delete tag
* delete product-tag links
Problem when selecting a list of products. One request does not work - for 50 products, 50 requests for tags. Do denormalization for the list of tags of each product - then when the tag is deleted (moderation), this table is difficult to update, and there may be a data discrepancy. How is this solved in Symfony+Doctrine?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lander, 2018-03-23
@usdglander

Denormalizing tags is insanity IMHO.
* delete tag
* delete product-tag links
Use foreign keys with CASCADE on DELETE.

D
Dmitry, 2018-03-23
@dastanaron_dev

I also think that QueryBuilder is needed here and joining records using Left Join, then it will be possible to filter by tags. In general, it is better to always do complex bundles through QueryBuilder in order to avoid a large number of queries IMHO.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question