protected function getAutoForm($formType = 'main_entity') { if ($this->autoForm == null) { $id = $this->getOperationalEntityId(); $action = "/admin/{$this->controllerName}/edit/" . ($id ? "id/{$id}" : ''); $form = new Zend_Form(array('action' => $action, 'method' => 'post')); // Build AutoCrud $autoForm = new Awe_Form_AutoMagic($formType, $this->doctrineColumns, $this->getOperationalEntity()); $form->addSubform($autoForm, 'awe_form'); $this->autoForm = $form; } return $this->autoForm; }
public function testMultiFileWithOneFile() { $form = new Zend_Form(); $element = new Zend_Form_Element_File('file'); $element->setMultiFile(1); $subform0 = new Zend_Form_SubForm(); $subform0->addElement($element); $subform1 = new Zend_Form_SubForm(); $subform1->addSubform($subform0, 'subform0'); $subform2 = new Zend_Form_SubForm(); $subform2->addSubform($subform1, 'subform1'); $subform3 = new Zend_Form_SubForm(); $subform3->addSubform($subform2, 'subform2'); $form->addSubform($subform3, 'subform3'); $form->setView(new Zend_View()); $output = (string) $form; $this->assertNotContains('name="file[]"', $output); }
public function testMultiFileInSubSubSubform() { $form = new Zend_Form(); $element = new Zend_Form_Element_File('file'); $element->setMultiFile(2); $subform0 = new Zend_Form_SubForm(); $subform0->addElement($element); $subform1 = new Zend_Form_SubForm(); $subform1->addSubform($subform0, 'subform0'); $subform2 = new Zend_Form_SubForm(); $subform2->addSubform($subform1, 'subform1'); $subform3 = new Zend_Form_SubForm(); $subform3->addSubform($subform2, 'subform2'); $form->addSubform($subform3, 'subform3'); $form->setView(new Zend_View()); $output = (string) $form; $this->assertContains('name="file[]"', $output); $this->assertEquals(2, substr_count($output, 'file[]')); }