我有Extent
的aredux-orm模型,如下所示:
const { string, number, arrayOf, oneOfType, instanceOf } = PropTypes
export default class Extent extends ValidatingModel {}
Extent.fields = {
xmin: attr(),
ymin: attr(),
xmax: attr(),
ymax: attr(),
zoomlevel: attr(),
tooltip: attr(),
tooltipDelay: attr(),
layers: many('Layer', 'extents'),
users: fk('User', 'extents')
}
Extent.propTypes = {
xmin: number,
ymin: number,
xmax: number,
ymax: number,
zoomlevel: number,
tooltip: string,
tooltipdelay: number,
layers: oneOfType([
arrayOf(number),
arrayOf(
instanceOf(Layer)
)
])
}
Extent.modelName = 'Extent'
我有相似的Layer
模型,其定义如下:
const {
string,
number,
bool,
any,
oneOfType,
instanceOf
} = PropTypes
export default class Layer extends ValidatingModel {}
Layer.fields = {
objtype: fk('Bo', 'layers'),
layertype: attr(),
label: attr(),
layertypevalue: attr(),
geometrytype: attr(),
opacity: attr(),
token: attr(),
url: attr(),
readonly: attr(),
isFetching: attr(),
'default': fk('LayerConfiguration'),
status: attr(),
enabled: fk('LayerConfiguration', 'enabledLayers'),
highlighted: fk('LayerConfiguration', 'highlightedLayers'),
disabled: fk('LayerConfiguration', 'disabledLayers'),
filtered: fk('LayerConfiguration', 'filteredLayers'),
editing: fk('LayerConfiguration', 'editingLayers')
}
Layer.options = {
idAttribute: 'layerId'
}
我像这样为他们引导数据:
const victoriaExtent = Extent.create({
xmin: 144.776008,
ymin: -37.8458979,
xmax: 145.101998,
ymax: -37.6845001,
zoom: 15,
tooltip: 'Victoria',
tooltipDelay: 0
})
const transformer = Layer.create({
layerId: 1,
label: 'Transformer',
objtype: 'EQUI',
layertype: 'PLANPLANT',
layertypevalue: '0001',
geometrytype: 'Point',
opacity: 1,
token: null,
url: null,
readonly: false,
extents: [ victoriaExtent ],
status: 'default',
isFetching: false,
'default': null,
enabled: transformerEnabledConfig,
highlighted: highlightPointConfig,
disabled: transformerEnabledConfig,
filtered: transformerEnabledConfig,
editing: editingPointConfig
})
在州内,我发现虽然SessionBoundModel
状态extents
显示Layer
ExtentsLayer
,但该关系并未填充。 extent.layers
关系模型未填充数据。
此外,当我访问范围时,我发现undefined
属性为/ # telnet MY_IP_ADDRESS 80
HTTP/1.0 408 Request Time-out
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>408 Request Time-out</h1>
Your browser didn't send a complete request in time.
</body></html>
Connection closed by foreign host
。
答案 0 :(得分:1)
我不明白为什么(还)但我发现从另一方接近这种关系(这是如何定义的)会产生结果。我将bootstrapping改为:
// Apply pagination
当我在.FirstOrDefault()
选择器中使用以下语句时,使用这种定义方式:
const victoriaExtent = Extent.create({
xmin: 144.776008,
ymin: -37.8458979,
xmax: 145.101998,
ymax: -37.6845001,
zoom: 15,
tooltip: 'Victoria',
tooltipDelay: 0,
user: spilli,
layers: [
transformer
]
})