First my specific question: What should I do to be able to select between all doctors when creating a new appointment?
Now the background:
After updating from Typo 4.7 to 6.2 I have a few problems like this one:
When creating a new Appointment
I need a select-field where the user selects a Doctor
.
So I made this:
<f:form.select property="doctor" options="{doctors}" optionLabelField="lastName" />
My Extensionbuilder settings:Appointment
is an entity that has a Doctor
relation of type:"n:1"Doctor
is an entity that extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
In my AppointmentController I've put
/**
* doctorRepository
*
* @var \Vendor\Extensionname\Domain\Repository\DoctorRepository
* @inject
*/
protected $doctorRepository = NULL;
And in newAction
I wrote:
$doctors = $this->doctorRepository->findAll();
...
$this->view->assignMultiple(array(
'doctors' => $doctors,
));
This way no items show up in my select field, even though I have some fe_users of type Doctor
.
Then I tried to see what's inside $doctors
by doing this:
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($doctors);
but it said:
Caught exception: Unknown column 'fe_users.sorting' in 'order clause'
Edit: The accepted answer solved this problem.
Then it showed the lawyer-objects, but the select was still empty. I found the answer to that problem myself later (see my own answer).