[FLOW3-general] Best practice for data over 3 tables

Manfred Rutschmann - VOLUMEN Werbe-/Internetagentur rutschmann at agentur-volumen.de
Thu Mar 7 20:10:37 CET 2013


Hi list,

and a question again:

I have company, project and task

Each project save a relation one company

Each task save a relation to a project

Project have state open/closed
Task have state open/closed

Now i need different views:

Companies that has projects
Companies that has open projects
Companies that has closed projects
Companies that has open projects and closed tasks
Companies that has open projects and open tasks

In frontend i need this data in treeview:

if company have open projects, show company and open projects, if there open tasks show the tasks

if company have open projects, but no tasks, show it. This gives me these views:


company 1
	- project 1
		- open task 1
		- open task 2

company 2
	- project 1

company 3 (not shown, because no projects)

and in other circumstances:

company 1
	- project 1
		- closed task 1
	- project 2
		- closed task 2
		- closed task 3

company 2 (not shown because it has open projects, but no closed tasks in it)

I hope this was clear.

I have no idea how to achieve this. I need grouped companies with grouped projects with all related tasks. Can i do this with the repo methods?

Example Company repository

$query->equals("project.task.open", 1)

This gives me the companies where in projects are open tasks. But i need the all talen projects by this query and all taken tasks. I can do somthing with foreach in fluid, but with the standard getter for projects and tasks i get all projects and all tasks. Hope you understand my problem.

I can make in my controller for loops over the companies, then make loops over the project to get the tasks. I think this is not effective. I think a way over the repository with grouped data over 3 tables are many faster and more secure to my code, instead of doing some manual loops.

Many thanks if you have some hints for me.

Regards Manfred


More information about the FLOW3-general mailing list