Typo3 访问现有表以使用它的数据 [英] Typo3 accessing an existing table to consume data of it
本文介绍了Typo3 访问现有表以使用它的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试将现有表集成到我的扩展中.问题是表格的内容没有被接管.我使用现有表的名称创建了一个新模型,并根据现有列名命名了属性.我也实现了相应的属性的getter和setter.
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.
现有表的名称是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.
提前致谢.
更新:
我试过了:
/**
* Protected Variable objectManager wird mit NULL initialisiert.
*
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager = NULL;
和 listAction():
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);
}
但是没有返回结果.
推荐答案
解决方案是:
$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);
这篇关于Typo3 访问现有表以使用它的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文