@startuml

actor User
participant Controller
participant ExportFormType as eft
participant ExportManager as em
participant SelectedExport as se
participant AggregatorFormType as aft
collections aggregators as a
participant FilterFormType as fft
collections filters as f


User -> Controller: request "/exports/new/<id of the export>?step=export"

activate Controller
Controller -> eft: build the form (AbstractType::buildForm)

activate eft
eft -> em: get the export

activate em
em -> eft: return the SelectedExport
deactivate em

eft -> se: get the Export Type

activate se
se -> eft: return the export Type (a string)
deactivate se

eft -> aft: build the subform 'aggregators'
activate aft

aft -> em: get aggregators for this export type
activate em
em -> aft: return a collection of aggregators
deactivate em

loop for each aggregator
  aft -> a: build eventual subform for the aggregator 
  activate a
  a -> a: append enventually his form
  a -> aft
  deactivate a
end

aft -> eft
deactivate aft

eft -> fft: build the subform 'filters'
activate fft 

fft -> em: get filters for this export type
activate em
em -> fft: return a collection for filters
deactivate em

loop for each filter
  fft -> f: build eventual subform for the filter
  activate f
  f -> f: append eventually his form
  f -> fft
  deactivate f
end

fft -> eft
deactivate fft

eft -> se: build eventual subform for the export itsefl
activate se
se -> se: append eventually his form
se -> eft 
deactivate se

se -> Controller: return a well-build form
deactivate se

Controller -> User: render the page with the form
deactivate Controller
@enduml

