I have two entities that are joined by a ManyToOne relation. Each entity has it's own set of validators. When I submit a form for the one object, the related object is also being validated. Is there any way that the related object can not be validated?
Here is an example, I am using Symfony2 PR11: class User { ... /** * @orm:Column(type="string",nullable=false, unique=true) * @assert:NotBlank() */ protected $name; /** * @orm:ManyToOne(targetEntity="City") * @orm:JoinColumn(name="city_id", referencedColumnName="id",nullable=false) * @assert:NotNull() */ protected $city; } class City { ... /** * @orm:Column(type="string",nullable=false) * @assert:NotBlank() */ protected $name; } In my UserForm configure() I add a reference to the City: $this->add(new EntityChoiceField('city', array( 'em' => $em, 'class' => 'MyBundle\Entity\City', 'property' => 'name' ))); The form displays correctly and creates a drop down list of all existing cities pulled from the database. When I submit my UserForm and validate it, I get errors that the city is missing a name. Why is the validation propagating down to the related object? All the user object needs to know is if the city id is present and it doesn't need all the additional fields for the city. -- 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