我有一个自定义表的扩展,其中一个我不能工作。当我尝试findOneByUid()
从它,我似乎得到正确的记录,但除了uid
和pid
所有属性的值为null
。当提取一个模型时,除了uid,所有的属性都是空的
表的名字是:tx_myext_domain_model_advertisercategories
。我曾经在广告客户和类别之间有一个下划线,但看起来这是extbase期待的方式。
我已经配置:
- ext_tables.php & ext_tables.sql
- \域\型号\ Advertisercategories.php
- \域\库\ AdvertisercategoriesRepository.php
- \配置\ TCA \ Advertisercategories.php
我已上传编辑这些文件到Github的位置: https://gist.github.com/kuipersb/4a5ef7f14ecc979866ae
输出执行findOneByUid()
或我的自定义方法searchAdvertiser()
时,我得到如下:
object(VENDOR\MyExt\Domain\Model\Advertisercategories)[334]
protected 'advertiserId' => null
protected 'name' => null
protected 'uniqueCode' => null
protected 'discount' => null
protected 'uid' => int 1
protected '_localizedUid' => int 1
protected '_languageUid' => null
protected 'pid' => int 2
private '_isClone' (TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) => boolean false
private '_cleanProperties' (TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) =>
array (size=6)
'advertiserId' => null
'name' => null
'uniqueCode' => null
'discount' => null
'uid' => int 1
'pid' => int 2
但我希望:
advertiserId: 2
name: Test
unique_code: test
discount: 10.00
任何非常感谢!
它是否与扩展生成器在编辑之前创建的代码一起工作?当你在后端添加记录时,你会遇到错误吗? – Michael
我已经尽可能地从扩展程序生成器为广告客户和其他模型/存储库生成的代码复制了它。在后端添加记录似乎也没有工作..我得到一个空的表单。 –
您是否使用扩展程序生成器完成整个建模过程?这件事的基本思想是,你不需要复制和粘贴生成的“基本”东西的类,因为一切都应该由扩展创建。您可以在加载扩展程序的扩展程序构建器中发布建模窗格的屏幕截图吗? – Michael