I've a situation where two classes are related through a third class (m-2-m
relationship). For instance, an Article can have many related articles.

So I have a third class for instance ArticleRelated, corresponding to an
article_related table with an article_id and a article_related_id columns.

Now I've a form where for an article I display a doubleSelectList with all
associated articles to the edited one:
  $this->widgetSchema['related']  = new sfWidgetFormPropelChoice(array(
  'choices'=>ArticlePeer::retrieveArticles(),
  'model' => 'Article'
));
  $this->widgetSchema['related']->setOption('renderer_class',
'sfWidgetFormSelectDoubleList');

where ArticlePeer::retrieveArticles is:
public static function retrieveArticles(Criteria $c=null)
{
   if(!$c)  $c = new Criteria();
   $c->addAscendingOrderByColumn(ArticlePeer::TITLE);
   $articles = ArticlePeer::doSelect($c);
   $arr_articles= array();
   foreach ($articles as $article) {
     $arr_articles[$article->getId()] = $article->getTitle();
   }
   return $arr_articles;
}

Now when I save my article, I want also to save this relationship which
doesn't get saved automatically since it is not part of the model Article ..
how I do that?

thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
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