Reputation: 3484
I've created an extension with the entity appointments
and want it to display all of them in the frontend and backend. There are already a few records in the DB - but how can I display them?
Here's what I've done so far: I have selected a folder from where my extension should get all the appointments: Normally my appointments are created in the frontend but I can also add them manually in the backend:
Succesfully added in backend: It now shows it in the frontend:
But the problem is: The DB has more than one entry and the others aren't hidden or deleted!! Only the one I've created is displayed now...how can I make Typo3 automatically load everything from the DB into my appointment data Folder or reach my goal another way??
Upvotes: 0
Views: 686
Reputation: 101
Looking at the phpMyAdmin screenshot the basic problem seems to be that the existing records are on different pages. By default only records from the selected page/folder will be shown (UID 10 in your example). The other records are on pages 31 and 11.
If you are using Extbase for your frontend plugin you can adjust the query settings to ignore the storage page (pid) and show all records in your Repository class:
namespace MyVendor\MyExtKey\Domain\Repository;
class ExampleRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
// Repository wide settings
public function initializeObject() {
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($querySettings);
}
// Example for adjusting a single query
public function findEverything() {
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
return $query->execute();
}
}
If you create the records in the frontend you need to take care of flushing the page cache of the list view (or make it uncached for the first tries), so that new entries show up. Otherwise the cached page can get shown which will not include the newest entries for a couple of hours (depending on your cache settings).
Upvotes: 2
Reputation: 3354
Your records on the screenshot are on three different pages (31,10,11). You have only selected one in the "Record Storage Page"-Field. Deleted, hidden or extended (start;stopp) entries are only displayed if you set your Repository to do that.
The default behaivor of the extension builder doesn't use the record storage page field. To use one specific page set the constant for storage pid:
plugin.tx_myext.persistence.storagePid = 10
Than all your entries from the extension are stored in and displayed from page with uid 31.
Upvotes: 3