问题描述
在扩展名MyExt
中,我将模型Page
映射到TYPO3中的pages
表.首先,它向我显示了type mismatch
错误,无论如何,我继续进行了保存.
In my extension MyExt
, I mapped the model Page
to pages
table in TYPO3. Firstly it shows me the type mismatch
error, I anyhow went ahead and saved it.
发生以下情况:
- 我的页面树变成这样:
- 我的新记录表格"仅显示UID,但不显示标题:
- 我的页面编辑变为:
- My Page Edit becomes like this:
在我的MyExt/Configuration/TypoScript/setup.txt
中,我有这个:
config.tx_extbase.persistence.classes {
Tx_MyExt_Domain_Model_Page {
mapping {
tableName = pages
}
}
}
这是一个错误吗?还是我做错了什么?
Is this a bug ? Or something i'm doing wrong ?
这是我的/Domain/Model/Page.php
,只是它的一瞥.
This is my /Domain/Model/Page.php
, just a glimpse of it.
class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* uid
* @var int
* @validate NotEmpty
*/
protected $uid;
/**
* title
* @var string
* @validate NotEmpty
*/
protected $title;
/**
* __construct
*
* @return Page
*/
public function __construct() {
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle(){
return $this->title;
}
}
我的/Domain/Repository/PageRepository.php
是
class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
}
推荐答案
只需从文件my_ext/ext_tables.php
中删除整个$TCA['pages']
部分,或将其注释掉即可.
Just delete the whole $TCA['pages']
section from the file my_ext/ext_tables.php
, or comment it out.
如果设置,它将使用扩展名中的值覆盖TYPO3内核中的大多数默认TCA设置.您可能不需要为此的自定义设置.
If set, it overrides most default TCA settings from the TYPO3 core with values from your extension. You probably don't need custom settings for that.
这篇关于“映射到现有表"在扩展生成器中显示TYPO3中的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!