Questions tagged [Many-to-many] (27)

3
answers

Django: ManyToManyField change in method save()?

When sozdannyi models you need to analyze the contents of the fields and to make changes to the ManyToManyField. If save is invoked directly (in the view or from another model) — no problems. But when called from the admin — the result of the save will be replaced by the result of processing a form. I suspect that editing i...
Darion.Daniel asked October 10th 19 at 13:29
3
answers

The keys in crosstabs M-to-M?

I must say that different solutions I can understand and justify, but I want to hear the opinions of others. Common situation: there are three tables for two entities and cross-table that implements a many-to-many relationship between these two entities. Example: the professional (Expert) and technology (Technology) that th...
rosemarie.Balistre asked October 10th 19 at 11:30
3
answers

Symfony. Doctrine. Many-to-One. To select a single query, briefly

Learn Symfony. Probably something I do not know, but There are two tables, the relationship is Many-to-1. Well, let's say. the posts and authors of posts Need to have 10 posts and authors to them. Get all posts — this one request. For each post we get of the author is for each post on request. A total of 11 queries. And if...
2
answers

Checking existence of connection many-to-many in Doctrine

I have class Article: /** * @ORM\ManyToMany(targetEntity="Acme\UserBundle\Entity\User", inversedBy="like_articles") */ protected $like_users; the User class: /** * @ORM\ManyToMany(targetEntity="Acme\BlogBundle\Entity\Article", mappedBy="like_users") */ protected $like_articles; The established connection indicates tha...
Harvey asked October 3rd 19 at 03:37
2
answers

Which low-speed processing of large tables (ManyToManyField) in the administrative interface in Django?

Hello, dear community. Faced with the problem, rely on your comprehensive knowledge. The problem: There is here such model of the application book catalog (elcat): 1.# Table with books class book(models.Model): book_id = models.BigIntegerField(primary_key=True, unique=True) name = models.CharField(max_length=512) ... au...
dashawn.Pfannersti asked September 30th 19 at 17:48
2
answers

Mysql — how to optimize the relationship Many To Many?

Good afternoon. There are a number of issues for optimizing SELECT queries, I hope for your help) There are two tables: product (goods) and product_relation (related products). Communication - many-to-many. Which scheme would be more optimal?CREATE TABLE `product_relation`( `id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,...
Brook asked September 28th 19 at 03:43
0
answer

How to implement search on a many to many through table relations in YII in the standard method of search?

The question in the continuation: MySQL is a sample of the table many-to-manyThere is a table with the names of the shops `mags`: `mag_id`, `mag_name` the table with the goods there prodautsa tovs`: `tov_id`, `tov_name` and the junction table `mag_tov`: `mt_mag_id`, `mt_tov_id` Suppose there are goods 'milk', 'sausage', 'me...
Donny71 asked September 28th 19 at 03:18
1
answer

Table many-to-many admin

In the database there are three tables: shops, produtcs and a junction table shops_products (in one store can be different goods, the same product can be in different stores ). Table produtcs is filled separately. When adding a new (or editing an existing) store, you will need from the entire list of goods (produtcs) to cho...
kade.Bos asked September 27th 19 at 21:55
1
answer

Yii2 many-to-many with three tables. How to organize?

There is a table: - Author - Document it is seen that there is a connection between Many-to-Many. You need to create a third table Author-Document-relation , which will store the author_id:doc_id, i.e. relations. The question is how to organize the sample in the third table using the method ActiveQuery::hasMany() ?
Phyllis_Hand asked September 25th 19 at 18:21
1
answer

Yii2 how to make a filter for the records when communicating Many to Many?

There are three tables: categories, products and linking them (because product can have multiple categories). There is a page that displays all the products and filter by category. Thus, the filter can be selected from several categories. If the category was one in the filter, the sample of goods was solved in the usual get...
Cruz.Ward asked September 25th 19 at 17:28