Skip to content

Instantly share code, notes, and snippets.

@kriswallsmith
Created October 30, 2009 12:41
Show Gist options
  • Save kriswallsmith/222308 to your computer and use it in GitHub Desktop.
Save kriswallsmith/222308 to your computer and use it in GitHub Desktop.
<?php
class MyForm extends sfForm
{
public function configure()
{
$subForm = new sfForm();
$subValidators = array();
$replace = new sfValidatorSchema(null, array('allow_extra_fields' => true, 'filter_extra_fields' => false));
for ($i = 0; $i < 2; $i++)
{
$productPhoto = new ProductPhoto();
$productPhoto->setProduct($this->getObject());
$form = new ProductPhotoForm($productPhoto);
$subValidators[$i] = $form->getValidatorSchema();
$form->setValidatorSchema($replace);
$subForm->embedForm($i, $form);
}
$this->embedForm('newPhotos', $subForm);
$this->mergePostValidator(new MyPostValidator(array(
'sub_validators' => new sfValidatorSchema($subValidators),
'sub_forms' => $subForm,
)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment