2017-08-24 50 views

回答

3

您可以使用DataMapper获取模型的表名称。它由存储库在内部使用(至少是间接的)来告诉他们正在处理什么。你可以得到自己的DataMapper的实例,并使用它像这样:

$className = \MyVendor\MyExt\Domain\Model\SomeModel::class; 
$dataMapper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class); 
$tableName = $dataMapper->getDataMap($className)->getTableName(); 

看看的SqlDebuggerUtilitythis github repository,它是使用DataMapper的获得QueryResult对象的表名调试SQL语句。