symfony/symfony — Issue #3201: One to many relationship doesn't behave as expected when using collections in forms
Author: gavinwilliams-fishrod
Created: 2012-01-27 19:09:05+00:00
State: open

When using entity's in Doctrine with one-many relationships using a form collection, Symfony does not assign the parent entity to the child entity. Using 'by_reference' => false with cascade-persist fails and the child entity's foreign key is null in the database.

The following appears to remedy the issue within the set method in the entity.

``` php
foreach($links as &$link){
$link->setHub($this);
}
```

Surely Symfony should do this within bindRequest in the form itself?