In a document management system I’m building each document belongs to
a company and a department in that company. So far so good, but the
problem is that a single document can also belong to multiple
companies and departments.
What I would like to do is to have different pages with links to
documents for each company and on those pages divide them under the
What is the best way to handle a situation like this?
My initial thinking is to only link the document to the departments
because the department has a child relationship to the company. But
then the code to get all documents for a specific company seems to get
Any insights on how to structure this would be most welcome.