Development

#6730 (Form generated by sfDoctrineFormGeneratedTemplate.php does not save many-to-many relationships)

You must first sign up to be able to contribute.

Ticket #6730 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

Form generated by sfDoctrineFormGeneratedTemplate.php does not save many-to-many relationships

Reported by: mnc Assigned to: Jonathan.Wage
Priority: minor Milestone:
Component: sfDoctrinePlugin Version: 1.2.7
Keywords: Cc:
Qualification: Unreviewed

Description

Using symfony 1.2.7 w/sfDoctrinePlugin and upgrading to Doctrine 1.1.x, many-to-many relationship handling doesnt work any more, while saving a Doctrine form.

Possible reason: in Doctrine 1.1.x Doctrin_Record::link() and ::unlink() methods were extended by a new parameter: now = false which prevents handling relationships right in the database by default.

Either reordering the parent::doSave($con) with many-to-many relation's saveXXXX method calls or extending the link(), unlink() methods with $now = true parameter in the generator sfDoctrineFormGeneratedTemplate.php could be a solution.

protected function doSave($con = null)
  {

<?php foreach ($this->getManyToManyRelations() as $relation): ?>
    $this->save<?php echo $relation['alias'] ?>List($con);
<?php endforeach; ?>

    parent::doSave($con);
  }

Unfortunately these changes would brake the default plugin w/Doctrine 1.0.x :( wouldnt they?

This is propably a related ticket to this problem:

http://trac.symfony-project.org/ticket/6285

Change History

07/07/09 01:05:50 changed by Jonathan.Wage

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in symfony 1.3 as it uses Doctrine 1.2

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.