Which is considered best practice? What are the benefits to each? To create two separate Zend\Form\Form objects - one for inserting and one for updating? Or to have a single Zend\Form\Form object and using different validation when Inserting to allow for an empty identification field.
I'm new to ZF2 and ran into this situation and was wondering which method to use. The forms are identical except when updating I have a field which identifies the PK in my table to determine which record to update. When I used the same form for insertion the validation would fail because that field was empty.
I've saw this question which suggests a single validation rule can be created which would return true on empty/null or if a value is provided would return true if it met the rest of the conditions. But this was really all I could find on SO or Google on the specific subject.