Hmm. This is an issue because we unlink() everything first then relink the selected records. Can you create a ticket and we'll have to fix this in a later version..
Thanks, Jon On Tue, Feb 10, 2009 at 7:58 AM, juro <[email protected]> wrote: > > Hi, > I am using Doctrine for this project and have a problem with the > following scenario. > > Article: > actAs: > Timestampable: ~ > columns: > id: > type: integer(11) > primary: true > autoincrement: true > title: string(255) > relations: > Categories: > class: Category > local: article_id > foreign: category_id > refClass: ArticleCategory > foreignAlias: Categories > > Category: > actAs: > Timestampable: ~ > columns: > name: > type: string(255) > notnull: true > slug: > type: string(255) > notnull: true > relations: > Article: > local: category_id > foreign: article_id > refClass: ArticleCategory > foreignAlias: Article > > ArticleCategory: > columns: > article_id: > type: integer(11) > primary: true > category_id: > type: integer(11) > primary: true > rank: > type: integer > default: 0 > relations: > Article: > onDelete: CASCADE > Category: > onDelete: CASCADE > > Now I have generated a custom form to assign the 'rank' field but > whenever I update an article, rank is set to 0. I want the rank to > stay what it is stored when saving an article. I am assuming that I > have to update this method: > > public function saveCategoriesList($con = null) > { > if (!$this->isValid()) > { > throw $this->getErrorSchema(); > } > > if (!isset($this->widgetSchema['categories_list'])) > { > // somebody has unset this widget > return; > } > > if (is_null($con)) > { > $con = $this->getConnection(); > } > > $this->object->unlink('Categories', array()); > > $values = $this->getValue('categories_list'); > if (is_array($values)) > { > $this->object->link('Categories', $values); > } > } > > Any ideas how I can handle the rank field? > > juro > > > -- Jonathan H. Wage Open Source Software Developer & Evangelist http://www.jwage.com http://www.doctrine-project.org http://www.symfony-project.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
