Additional fields for many-to-many relationship

I’m looking for a way to accomplish something. This is the simple breakdown of what exists:

  • Employee entity - Simple data collection; firstName, lastName
  • Project entity - Simple data collection; projectName, projectStartDate
  • ProjectCheckIn entity - Many-to-One association to Project entity projectName attribute, Many-to-Many association to Employee entity (ability to add multiple employees)

What I need to figure out is a way to add several numeric fields (hours worked, etc.) for each employee associated to the project check in. As of now, I’m in the dark as to how to accomplish this within CUBA.

I would really appreciate any thoughts about how to do this.

Thanks in advance.

Upon thinking of this issue, maybe even a way to access the join table would help.

1 Like

I’ve yet to have any luck in figuring this out. Still aggressively searching for ideas.

Hi Adam,

try to take a look at:
https://www.cuba-platform.com/guides/data-modelling-many-to-many-association?_ga=2.165700350.1181434055.1566198610-1740988402.1561972943#indirect_many_to_many_association_with_joining_entity

You can create a joining entity containing the attributes you need (hours…) beetween ProjectCheckIn and Employee.

2 Likes

Hello Alunetti,

I’m still studying this, trying to figure out exactly how to do it for my example. I really appreciate the information. I just need to figure out how to connect the dots. As of now, this seems to have the functionality I need, but it’s a bit convoluted for my level of understanding.

I’m marking this as the solution, as it’s now obvious to me that this is exactly what I need, despite not being able to get it working properly yet.

As an aside, in this example that I’ve given, I’d like to ask advice of how I’d set this up. This is what I’m thinking:

  • Employee entity - Simple data collection; firstName, lastName (unchanged from above)
  • Project entity - Simple data collection; projectName, projectStartDate (unchanged from above)
  • EmployeeCheckIn entity - Many-to-One association for Employee entity firstName lastName attributes, hoursWorked, costAssociated attributes
  • ProjectCheckIn entity - Many-to-One association to Project entity projectName attribute, One-to-Many composition to EmployeeCheckIn entity

Is this on the right track?

Thanks in advance

Never mind. This is definitely it! I just got it working correctly! Woooo! Thanks again for your help. It was huge.

2 Likes