我用域模型创建了一个扩展Message.该模型与TYPO3 pages(具有页面的详细信息,如title,issite_root等)表有一个关系m:n .但是,通过使用该mapping to existing tables选项,它给出了type错误说页面:
The configured type field for table "pages" is of type int(11) unsigned
This means the type field can not be used for defining the record type. 
You have to configure the mappings yourself if you want to map to this
table or extend the correlated class
所以我只是创建没有映射的关系,以便我以后可以映射它setup.txt.

我Pages在MyExt/Classes/Domain/Model/所有getter/setter和repository中创建了模型MyExt/Classes/Domain/Repository/.
在我的setup.txt中,我这样做了:
config.tx_extbase {
    persistence{
        enableAutomaticCacheClearing = 1
        updateReferenceIndex = 0
        classes {
        Tx_Playfield_Domain_Model_Pages {
            mapping {
                    tableName = pages
                columns {
                                uid.mapOnProperty               = uid
                                pid.mapOnProperty               = pid
                                sorting.mapOnProperty           = sorting
                                title.mapOnProperty             = title
                                subtitle.mapOnProperty          = subtitle
                            }
                }
            }
      }
    }
}
但是当我尝试访问我创建的Pages模型时,
var_dump($this->pagesRepository->findByUid(74));
tx_playfield_domain_model_pages它表明,它的搜索不存在
Table 'typo3.tx_playfield_domain_model_pages' doesn't exist: SELECT tx_playfield_domain_model_pages.* FROM tx_playfield_domain_model_pages WHERE tx_playfield_domain_model_pages.uid = '74' LIMIT 1
我在这里错过了什么?
更新
按照@Michael建议的http://t3-developer.com/extbase-fluid/cheats-extbase/model/tabelle-pages-in-extbase/后,我得到一个empty result来自$this->pagesRepository->findByUid(74)
setup.txt正在加载.我这样做是为了检查它:
plugin.tx_playfield{
settings{
 temp=yes
}
}
这是从我的控制器访问.
您是否有可能没有创建Pages域模型(在扩展构建器中或根本没有创建)?该文件my_ext/Classes/Domain/Model/Pages.php需要存在。检查您的“页面”域模型是否将“映射到现有表”属性设置为“页面”,它应该如下所示:

我不知道你的错误到底在哪里,但我在扩展构建器中做了一些更多的修改并使其工作。您可能可以通过将您的扩展游戏场与我的临时扩展测试场进行比较来找到答案:在此处下载(已更新)。
顺便说一句,您不需要映射不想在前端显示的属性,除非它们的名称不同。
        mapping {
            tableName = pages
            columns {
                title.mapOnProperty = title
                subtitle.mapOnProperty = subtitle
            }
        }
| 归档时间: | 
 | 
| 查看次数: | 8073 次 | 
| 最近记录: |