hm, I should have read your first email with more attention, it makes sense...
So we're back to your original question. I can see a few shortcomings: - If the middle class is versioned, version numbers don't mean anything there. Adding an author adds a record, changing an author probably adds and removes an author... No place for a true revision system on the corresponding table - If you take a global revision number, which tables decides of it in the case of a middle class ? If the user revision changes, the user-article middle class revision should change, as well as when the article changes - Serializing the middle class objects will indeed take alot of space Now what if your middle class had an autoincrement primary key, and that you stored in the article table a serialized array of the ids of the related user-article records, as a complement to the 1-n relationship ? But there might be some smarter solutions, and I'm sure you're not the first one to ask the question. Anybody has a better idea ? François 2008/2/15, Georg Sorst <[EMAIL PROTECTED]>: > > > Almost, Francois :) > > However, the case you described is just a many-to-one-relation. I am > looking for a solution to version many-to-many-relations. The problem > with these is that the related objects aren't a property of the object. > Only through the relations defined in the database schema a connection > between them can be made. However, only the actual properties of the > object will be saved in the version. > > Best regards, > Georg > > Francois Zaninotto schrieb: > > > Well, the the ->toVersion() method does the trick, doesn't it ? > > > > $article = new Article(); > > > > $author1 = new User(); > > $author1->setName('john'); > > $article->setAuthor($author1); > > $article->save(); // -> creates version 1 > > > > $author2 = new User(); > > $author2->setName('jane'); > > $article->setAuthor($author2); > > $article->save(); // -> creates version 2 > > > > $article->toVersion(1); > > echo $article->getAuthor()->getName(); // john > > > > François > > > > > > > 2008/2/13, Georg Sorst <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>: > > > > > > > Hey Francois, > > > > Francois Zaninotto schrieb: > > > > > Hi Georg, > > > > > > You could do: > > > > > > $article->setUpdatedAt($time); > > > $article->setVersionCreatedBy($authorname); > > > $article->save(); > > > > > > That vould create a new version of the article with just a > > difference in > > > the revision author. > > > > > > Or did I miss your point ? > > > > > > Actually, yes. I want to be able to restore an old version and see > to > > which foreign objects this object had been linked in the previous > > version through the many-to-many relations. > > > > > > > > François > > > > > > > Best regards, > > Georg > > > > > > > 2008/2/12, Georg Sorst <[EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]>>>: > > > > > > > > > > > Hey everyone, > > > > > > I'm happily using the sfPropelVersionableBehaviorPlugin which > > just got a > > > lot better thanks to the recent improvements. However I've run > > into a > > > problem or limitation which I'm not sure how to handle. > > > > > > When using many-to-many relations (say > > Author-AuthorArticle-Article) the > > > middle table is usually not manipulated directly but only > > through the > > > outer tables (Author and Article). So when I add an author to > > an article > > > (ie. just modifying the middle table) I want to create a new > > version of > > > the Author object so I can see when it has been changed and > > which author > > > has been added or removed at what time. The corresponding > Article > > > object(s) should be given a new version as well since it / > > they has also > > > been changed. > > > > > > Clearly the Versionable Plugin is not able to do this > > currently. What > > > would be the right approach to solve this problem? I've > > thought about > > > serializing the respective properties of the object like > > > "collAuthorArticles" and so on and then unserializing them > > again when an > > > old version is retrieved. This should work however requires a > > way to > > > figure out all the many-to-many relations of an object and > > will probably > > > waste lots of space for all the unchanged relations in each > > version. > > > Another way would probably be to use a global version or > > revision number > > > like Subversion does. I haven't given this too much thought > > since this > > > is a completely different approach. > > > > > > Anyway, if anyone has any ideas on this I'd love to hear them! > > > > > > Thanks, > > > Georg > > > > > > > > > > > > > > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---