The problem is that your 2 relations have the same name -> the latter will override the former.
So: - Use a unique name for each of your relation, - Add a 'class: sfGuardUser' to each of them. You should use the users mailing list for such issue: http://symfony.com/blog/getting-help-on-symfony1-or-symfony2 Cheers, Victor On Jun 30, 3:55 pm, "ludo...@escapadarural.com" <ludo...@escapadarural.com> wrote: > Hi all, > > I might have stumble upon a bug in sfDoctrineGuardPlugin ... unless > I'm doing something wrong. > > For this schema.yml : > Bug: > actAs: { Timestampable: ~ } > columns: > updater_id: { type: integer } > approver_id: { type: integer } > relations: > sfGuardUser: > local: updater_id > foreign: id > alias: updater > foreignAlias: updatedBug > sfGuardUser: > local: approver_id > foreign: id > alias: approver > foreignAlias: approvedBug > > The BugBase generated is the following : > abstract class BaseBug extends sfDoctrineRecord > { > public function setTableDefinition() > { > $this->setTableName('bug'); > $this->hasColumn('updater_id', 'integer', null, array( > 'type' => 'integer', > )); > $this->hasColumn('approver_id', 'integer', null, array( > 'type' => 'integer', > )); > > $this->option('collation', 'utf8_unicode_ci'); > $this->option('charset', 'utf8'); > $this->option('type', 'InnoDB'); > } > > public function setUp() > { > parent::setUp(); > $this->hasOne('sfGuardUser as approver', array( > 'local' => 'approver_id', > 'foreign' => 'id')); > > $timestampable0 = new Doctrine_Template_Timestampable(); > $this->actAs($timestampable0); > } > > } > > And the table looks like (cutted table) : > mysql> show indexes from bug; > +-------+-------------------+------------------------ > +--------------------+----------------------+ > | Table | Non_unique | Key_name | Seq_in_index | Column_name > | > +-------+-------------------+------------------------ > +--------------------+----------------------+ > | bug | 0 | PRIMARY | 1 | > id | > | bug | 1 | approver_id_idx | 1 | > approver_id | > +-------+-------------------+----------------------- > +---------------------+----------------------+ > 2 rows in set (0.00 sec) > > I was expecting somthing more like : > abstract class BaseBugExpected extends sfDoctrineRecord > { > public function setTableDefinition() > { > $this->setTableName('bug'); > $this->hasColumn('updater_id', 'integer', null, array( > 'type' => 'integer', > )); > $this->hasColumn('approver_id', 'integer', null, array( > 'type' => 'integer', > )); > > $this->option('collation', 'utf8_unicode_ci'); > $this->option('charset', 'utf8'); > $this->option('type', 'InnoDB'); > } > > public function setUp() > { > parent::setUp(); > $this->hasOne('sfGuardUser as updater', array( > 'local' => 'updater_id', > 'foreign' => 'id')); > $this->hasOne('sfGuardUser as approver', array( > 'local' => 'approver_id', > 'foreign' => 'id')); > > $timestampable0 = new Doctrine_Template_Timestampable(); > $this->actAs($timestampable0); > } > > } > > mysql> show indexes from bug; > +-------+-------------------+------------------------ > +--------------------+----------------------+ > | Table | Non_unique | Key_name | Seq_in_index | Column_name > | > +-------+-------------------+------------------------ > +--------------------+----------------------+ > | bug | 0 | PRIMARY | 1 | > id | > | bug | 1 | updater_id_idx | 1 | > updater_id | > | bug | 1 | approver_id_idx | 1 | > approver_id | > +-------+-------------------+----------------------- > +---------------------+----------------------+ > 2 rows in set (0.00 sec) > > I think it's a bug. Am I right ? > if yes, I guess I should report it. Where and how ? > > Many thanks. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
