Search code examples
typo3typo3-6.2.xtypo3-7.6.xtypo3-extensions

Typo3 accessing an existing table to consume data of it


I tried to integrate an existing table to my extension. The problem is that the content of the table isn't taken over. I created a new model with the name of the existing table and named the properties according to the existing column names. I also implemented the corresponding getters and setters of the properties.

enter image description here

The name of the existing table is tx_institutsseminarverwaltung_domain_model_event.

What is my failure in this case? Just want to access the data of an existing table from another extension.

Thanks in advance.

UPDATE:

I tried this:

/**
 * Protected Variable objectManager wird mit NULL initialisiert.
 *
 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
 * @inject
 */
protected $objectManager = NULL;

and listAction():

/**
 * action list
 *
 * @return void
 */
public function listAction() {
    echo "test";
    $theRepository = $this->objectManager->get('\TYPO3\institutsseminarverwaltung\Domain\Repository\EventRepository');
    $yourRecords = $theRepository->findAll();
    $this->view->assign('events', $yourRecords);
}

But no results returned.


Solution

  • solution is:

        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
        $querySettings->setRespectStoragePage(FALSE);
    
        $theRepository = $this->objectManager->get('TYPO3\\institutsseminarverwaltung\\Domain\\Repository\\EventRepository');
        $theRepository->setDefaultQuerySettings($querySettings);
    
        $yourRecords = $theRepository->findAll();
        $this->view->assign('events', $yourRecords);