class ProductGalleryCollectionForm extends sfForm { public function configure() { if (!$product = $this->getOption('product')) { throw new InvalidArgumentException('You must provide a product object.'); } for ($i = 0; $i < $this->getOption('size', 2); $i++) { $ProductGallery = new ProductGallery(); $ProductGallery->Owner = $product; $form = new ProductGalleryForm($ProductGallery); $this->embedForm($i, $form); } $this->mergePostValidator(new ProductGalleryValidatorSchema()); } // config }