Mapping to “pages” table from Extbase in TYPO3 6.1

前端 未结 2 1921
孤城傲影
孤城傲影 2021-01-13 12:13

I created an extension with a domain model Message. This model has a relation m:n with the TYPO3 pages (the one which has the details of the pages,

相关标签:
2条回答
  • 2021-01-13 12:46

    Is it possible that you didn't create the Pages domain model (within the extension builder or not at all)? The file my_ext/Classes/Domain/Model/Pages.php needs to exist. Check that your "Pages" domain model has the property Map to existing table set to pages, it should look like that:

    enter image description here

    I don't know where exactly your error is, but I did some more tinkering in the extension builder and made it work. You can probably find out by comparing your extension playfield to my temporary extension testfield: Download it here (updated).


    Btw, you don't need to map properties that you do not want to be displayed in the frontend unless they are named differently.

            mapping {
                tableName = pages
                columns {
                    title.mapOnProperty = title
                    subtitle.mapOnProperty = subtitle
                }
            }
    
    0 讨论(0)
  • 2021-01-13 12:47

    I think you have to write the mapping with camel case letters (the class name). Although this post is in German, I think the code might help you. The author added some fields he is going to use to the class and also added a mapping in the typoscript of the extension (see the example code there). The most important part of the German text is that this example there was designed only to read from the db. If you want to create new pages using the model, you have (at least) to add the TCA and setters in the model class to make it work.

    0 讨论(0)
提交回复
热议问题