On Jul 7, 9:57 am, Ashley Moran <ashley.mo...@patchspace.co.uk> wrote:
> Not everyone agrees that a call to Resource#save should save the whole > connected object graph. In my situation, this would be ideal > behaviour, but it may cause problems for other people. (Without > seeing code though, I don't know why.) In either case, though, I > think a better solution is needed. My biggest issue with this is clarity. Why call save on a specific resource anyway if it always saves everything? This alone would mean to me that it should move to another object because it apparently isn't Resource's concern. Naming methods and putting them in the right place is of major importance, especially for a framework like DataMapper. > One of the features of SQLAlchemy[SA] I pine for most in a Ruby ORM is > "Commit entire graphs of object changes in one step". This is a holy > grail to me. DataMapper already has an identity map, so it knows > about every resource in memory. How much work would it be to use this > to implement Repository#save, Repository#dirty and Repository#valid ? > (In the crudest case, you could surely just iterate over the identity > map?) I agree with providing a Repository#save. Imho it more correctly confers what it does, since if I would encounter this method for the first time I'd probably think that it means what it probably does :). It should possibly use the IdMap for a first try, don't know what the best case is though for handling code outside a repository block. -- Regards, Dirkjan Bussink --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamapper@googlegroups.com To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---