Greetings, I've been struggling with the new form component, particularly with the "entity" choice fields.
I have a "ContactInfo" Entity with some scalar fields (first_name, address, etc) and a ManyToOne relationship with "Cities". "Cities" has a ManyToOne relationship with "States" class ContactInfo { /** orm:ManyToOne(...) */ private $cities; function setCity($city) { $this->cities = $city; } } class Cities { /** orm:ManyToOne(...) */ private $states } // In ContactType::buildForm() $builder->add('city', 'entity', array( 'class' => 'Entity:Cities', 'query_builder' => $city_qb, 'property' => 'city_name', 'label' => 'City', )); It's pretty much the same for the "state" field. The first issue is a dependency on the EntityManager if we want to use an "entity" field in the form (it requires a QueryBuilder). I passed it in via the constructor and all is well, but if there is access to the EntityManager from within AbstractType::buildForm(). The second issue: Every time, whether the city changes or not, an UPDATE query is created for the city: UPDATE cities SET city_name = ?, county = ?, latitude = ?, longitude = ? WHERE city_id = ? Parameters: [columbia, boone, 38.896439, -92.246277, '5533'] The city should *never* be updated. How do I stop this? The third (***blocking***) issue: I have an AJAX setup where I re-populate the "cities" drop down when the state changes. If I do *not* change the state, the city saves fine. If the state changes, $form->isValid() returns false and no changes are committed to the database. The AJAX method in question *only* replaces the "<option>" tags in the select and works as expected. Roger -- 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 users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en