我也有课程和两个非 TYPO3 表。我将非 TYPO3 表定义为没有 uid、pid 等列的表。
我的两个班:
- Tx_Abc_Domain_Model_Location 类扩展 Tx_Extbase_DomainObject_AbstractEntity
- 类 Tx_Abc_Domain_Model_Facility 扩展了 Tx_Extbase_DomainObject_AbstractEntity
我的两个表(带列):
- 地点
- 邮政编码
- 城市
- 设施 ID
- 设施
- 设施 ID
- 姓名
我已经映射了这样的属性:
config.tx_extbase.persistence.classes {
Tx_Abc_Domain_Model_Location.mapping {
tableName = locations
columns {
zipcode.mapOnProperty = zipcode
city.mapOnProperty = city
facility_id.mapOnProperty = facility
}
}
Tx_Abc_Domain_Model_Facility.mapping {
tableName = facilities
columns {
facility_id.mapOnProperty = uid
name.mapOnProperty = name
}
}
}
我的问题:
我的位置模型的设施属性获得了类型Tx_Abc_Domain_Model_Facility
,当我通过 LocationRepository 查找位置时,它为我构建了一个包含设施模型的位置模型。
The problem appears, when I the search I am doing returns several results. i.e. the location with the zipcode 12345 has two different facilities (and the table locations got two rows with different facility_ids), then I would expect to get two location models and each of it got the right facility model.
But instead I get the two location models, which have all same facility model inside. They've got all the facility of the first found location.
Even if I change the type of the facility attribute to integer, there are the wrong ids. But if I enable raw query result in repository I get the correct ids.
I get also the correct ids or models, when I add to both tables an uid-column.
Is there no possibility to map tables without uid column with Extbase models?
Thanks.