On Jun 29, 2012, at 10:54 AM, Norbert Hartl wrote:
Am 28.06.2012 um 21:15 schrieb Stéphane Ducasse:
Hi guys
I would like to show in the magritte chapter I'm revisiting a bit more meat.
I'm playing with magritte 30 and I would like to know if there is a way to save
objects based on their magritte description.
Yes, there is. There is a description in an old blog post of mine [1]. Don't
be misled that magritte2 is mentioned there. It works as well with magritte3 (thanks to
Nick Ager). You can get it
Gofer new
renggli: 'magritte3addons';
package: 'ConfigurationOfMagritte3AddOns';
load
and load the default.
Excellent I will read it.
I'm reading magicMagritte right now.
BTW the Twitters stuff of nick is gorgeous :)
In a nutshell:
You add to your descriptions "beXmlAttribute" or "beXmlElement". Then
you can store an object with
myObject magritteDescription toXml: myObject
Ok cool.
I did that by hand in the past
importElement: aXMLItem
| anElement |
anElement := (self class mappingTable at: aXMLItem name) new.
self updateBackLinkOf: anElement.
anElement magritteDescription do:
[ :each |
| auth |
auth := aXMLItem attributeAt: each accessor readSelector asString.
(#(nil 'nil' ) includes: auth) ifFalse:
[ auth := each fromString: auth.
each accessor
write: auth
to: anElement ]].
self base add: anElement.
^ anElement
hope that helps,
Do you know how relationships are handled :)