0
votes

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).

2

2 Answers

1
votes

I think firstly you would need to fix the problem with missing column. For me it seems that during the update of TYPO3, database column fe_users.sorting was deleted. Maybe it wasn't defined properly in the ext_tables.sql files and database analyzer suggested to remove it? Such field does not exist in TYPO3 core, so it has to be added previously from your or third party extension. Please do the following:

  1. Check in the database if fe_users.zzz_deleted_sorting exists and if it is, change its name to fe_users.sorting and add field definition to your ext_tables.sql file:

    sorting int(11) DEFAULT '0' NOT NULL,

  2. If there is no field fe_users.zzz_deleted_sorting, it means that it was already deleted from the database. Please add SQL code from point 1. to ext_tables.sql and execute database comparison using install tool. It will suggest you to create new field - fe_users.sorting. Please create it.

Please also check if there are some other important differences in the database structure. Database analyzer will show you all of them.

When database issues is resolved give a feedback if anything changed. Then we can proceed with next issue.

EDIT:

Database issues are resolved, so we can go further.

I shows the lawyer-objects, but the select is still empty

It's possible that you get empty response from database, because storagePid is not defined. Extension Builder probably already created TypoScript configuration for you. Please do the following:

  1. Find file Confiugration/TypoScript/constants.txt in your extension directory.

  2. Check on which Page ID doctors records are created in the BE.

  3. Fill the storagePid with the appropriate Page ID number. StoragePid is in path: plugin.tx_[pluginkey].persistence.storagePid. It should be also defined by Extension Builder but it's value is probably empty.

0
votes

I found out the 2nd reason of my problem:
In my <f:render...> I didn't pass my doctors as arguments!

...arguments="{..., doctors:doctors}"/>