Reputation: 13
I have question or problem with query syntax. I have 2 entity tables related with ManyToMany
:
Person.php
/**
* @ORM/ManyToMany(targetEntity="Deal", inversedBy="persons")
* @ORM/JoinTable(name="persons_deals")
* /
protected $deals;
Deal.php
/*
* @ORM/ManyToMany(targetEntity="Person", mappedBy="deals")
* /
protected $persons;
This creates an "extra" table called persons_deals
in the database.
In that table is
"person_id" and "deal_id"
If a deal is done there is (for example):
person_id ---- deal_id
1 -------------- 1
2 -------------- 1
So if I want to get deal_id 1 and persons connected to it. What kind of query should I make?
Upvotes: 1
Views: 80
Reputation: 3051
There is no such thing as Symfony Query Language (or Syntax). You are probably talking about Doctrine.
So it's better covered at Doctrine documentation how to organize many-to-many relation.
Pay your attention, you'll probably have to fix namespaces from example to make it work at your code
So instead
you will need to make
Upvotes: 1
Reputation: 3690
This is covered in the documentation.
Joining Related Records in Symfony2
Upvotes: 0