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]>:
>
>
> 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]>>:
>
> >
> >
> >     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
-~----------~----~----~----~------~----~------~--~---

Reply via email to