English 中文(简体)
2. 理论2与表+额外领域
原标题:Doctrine 2 join table + extra fields

我抽出两张表格和一张表格:工作人员、叙级和工作人员叙级。 在合并表一中,有一门大豆:显示。 我的意思如下:

 /**
 * @ManyToMany(targetEntity="Staff", inversedBy="classifications")
 * @JoinTable(name="staff_classifications",
 *  joinColumns={@JoinColumn(name="staffid", referencedColumnName="id")},
 *  inverseJoinColumns={@JoinColumn(name="classificationid", referencedColumnName="id", unique=true)});
 */
  1. How do I add the extra field showclassifications to the join table?
  2. How do I reference the field via DQL? E.g. What query would get all of a staff s classifications that are allowed to be shown?
  3. Do I place the above annotation in one class and a @ManyToMany annotation with no @joinTable in the other? E.g. @ManyToMany (targetEntity="Classification")?
最佳回答

你们希望有一个实体来描述这种关系(章程),这个实体与工作人员和叙级都有“一”关系。

很多Tomany公司允许你拥有任何“外来”财产,因为合并表格不是实体,因此可能没有任何财产。

问题回答

暂无回答




相关问题
Can t use "Skip" in LINQ query

I have a linq query in which I need to specifically do a left join. However when I attempt to commit a lambda Skip function on the query it errors and says that the skip cannot be performed on a linq ...

sql joins and getting used to them [closed]

I had a big interview that I screwed up when the interviewer asked me to join three tables. I can verbally describe the different types of joins, but I froze up. I m looking for something that gets ...

Using annotations to implement a static join in hibernate

I m relatively new to hibernate and was wondering if someone could help me out. While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I m ...

LEFT OUTER JOIN (gives extra rows) problem

I have two tables which I want to join together using a left outer join. However, even though my left table contains only unique values, the right table satisfies the CONDITION more than once and as ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

Priming read for PHP Query

I am new to PHP and working on my own CMS for a project. Mostly to just give myself a project to learn the language. The CMS is working but I am just tracking down some bugs in it. So here it goes.....

Select statement performance

I m having a performance issue with a select statement I m executing. Here it is: SELECT Material.* FROM Material INNER JOIN LineInfo ON Material.LineInfoCtr = LineInfo.ctr INNER JOIN ...

热门标签