Hi All,
I'm just playing around with new form component. 

Let's say that we have two entities 'Job' and 'Category' with one to many 
relation between them.
-------        --------------
|Job | >--- |Category|
-------        -------------- 
Showing a selectable choice list where data is taken from Doctrine2 entity 
is very easy... (example taken form AcmePizzaBundle)

public function buildForm(FormBuilder $builder, array $options)
{
          $builder->add('category', 'entity', array('class' => 
'Application\Jobeet2Bundle\Entity\Category',
                                                      'label' => 
'Category'));
          .....
}
but..

When submitting the form, it exception raises "A new entity was found 
through a relationship that was not configured to cascade persist 
operations: . Explicitly persist the new entity or configure cascading 
persist operations on the relationship."

It tries to create a new 'Category' entity, which does not make any sense as 
it is already created and it's only selectable.

P.D. If (cascade : {persist} ) is set in the relation, that entity is 
created but duplicated.

Is that a bug?

Thanks in advanced. 

-- 
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 [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-devs?hl=en

Reply via email to