and in the superclass:
neoJsonMapping: aMapper
aMapper for: self do: [ :mapping |
mapping mapInstVar: #id to: 'id'.
]
(do not pay attention to mapInstVar or mapProperty, I was figuring out how things worked).
Thing is that the mapping goes fine up to one point.
super neoJsonMapping: aMapper�
indeed puts the right 'id' mapping but then�
aMapper for:: self do: [ ...
does
for: smalltalkClass do: block
"Create and add a new standard object mapping for smalltalkClass.
The code in block should further customize the mapping."
| mapping |
mapping := self newObjectMappingFor: smalltalkClass.
block value: mapping.
^ mapping
which in turn:
newObjectMappingFor: smalltalkClass
| mapping |
mapping := NeoJSONObjectMapping new.
mapping subjectClass: smalltalkClass.
self mappings at: smalltalkClass put: mapping.
^ mapping
Argh:� self mappings at: smalltalkClass put: mapping.
Overwrites the existing contents.
So, only the entries of the subclass are left.
I guess that's a bug.�
I'd do:
newObjectMappingFor: smalltalkClass
| mapping |
mapping := self mappings at: smalltalkClass.
mapping ifNil: [�
mapping := NeoJSONObjectMapping new.
mapping subjectClass: smalltalkClass.
self mappings at: smalltalkClass put: mapping.
].
^ mapping
instead.
Does this look right?�
mapping := self newObjectMappingFor: smalltalkClass.
isn't then really intention revealing. Shouldn't we rename that to objectMappingFor: smalltalkClass
Phil