Changes between Version 2 and Version 3 of relationships


Ignore:
Timestamp:
03/07/2011 06:29:45 PM (13 years ago)
Author:
christoph.neijenhuis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • relationships

    v2 v3  
    2626When checking out from Monticello, an additional instance variable is added to Class, causing a lenghty recompile. You probably want to do this on a new image.
    2727
     28To open the browser that supports relationships, you need to do: ''RelationshipBrowser open''
     29
    2830{{{
    2931#!div style="clear:both;"
     
    3234= How to Use =
    3335
    34 ''Write a small tutorial. Start with basic steps and then add more details. It is not necessary to explain the whole functionality.''
     36When editing relationships, use the relationship browser: ''RelationshipBrowser open''
    3537
     38I'll use a simple example to illustrate the use of this framework: We have a class ''Artist'' and a class ''Artwork''. Artists can create many artworks, but an artwork can only have a single artist. We therefore have a one to many relationship between artist and artwork.
    3639
     40=== Create a relationship ===
     41
     42In the relationship browser, select the ''Artist'' class and click on the relationship symbol: -->
     43
     44In the category menu, select ''OneToMany''. As you can see, there is a template for a ''OneToManyRelationship'' in the edit pane. Simply add the ''Artwork'' class as the right class and save. The new relationship has been created.
     45
     46If you go back to the instance view, you can see that ''Artist'' does now have the methods ''addArtwork:'', ''artworks'' and ''removeArtwork''. ''Artwork'' has the method ''artist''.
     47
     48=== Edit a relationship ===
     49
     50Assume we have found out that sometimes, multiple artists collaborate to create an artwork.
     51
     52Go back to the relationship view (use -->) and select the existing relationship. The edit pane is filled with the previous values. To create a many to many relationship, replace ''OneToManyRelationship'' with ''ManyToManyRelationship''. Hit save and look at the newly generated methods.
     53
     54Assume all artworks in this relationships are paintings. We don't want to create a new subclass for this, but change the name used in the methods.
     55
     56Select the existing relationship and add a name for the right class: ''rightClassName: 'painting' '' and save. The methods will be renamed.
     57
     58= Known limitations =
     59
     60The relationships are not added to monticello when saved (however, the generated methods and instance variables are - your code still works).
    3761
    3862= How to Extend =