All records for schools and programs can be accessed through a repository, which the Extension Builder already has created your you.
To make use of both repositories in your controller, you have to use dependency injection. Since ExtBase 4.7 you can just use the @inject
annotation to inject an object by dependency injection.
Add the following to your controller:
/**
* School repository
*
* @var \Vendor\Extension\Domain\Repository\SchoolRepository
* @inject
*/
protected $schoolRepository;
/**
* Program repository
*
* @var \Vendor\Extension\Domain\Repository\ProgramRepository
* @inject
*/
protected $programRepository;
After you have added both repositories to you controller, you can use them in your action.
Your action then looks like this:
/**
* action show
*
* @param \Vendor\Extension\Domain\Model\Form $form
* @return void
*/
public function showAction(\Vendor\Extension\Domain\Model\Form $form) {
$schools = $this->schoolRepository->findAll();
$programs = $this->programRepository->findAll();
$this->view->assign('schools', $schools);
$this->view->assign('programs', $programs);
}
Now your form should show both select boxes with all records from the school- and programm-repository.