protected function createFixture(array $data = array()) { $person = new Person('Scheit', '*****@*****.**', 'Philipp', Date::create('21.11.1984')); $formPanel = new EntityFormPanel('Person bearbeiten', $this->getTranslationContainer(), new EntityForm($person, $this->getEntityMeta('Psc\\Doctrine\\TestEntities\\Person')->getSaveRequestMeta($person))); $formPanel->createComponents(); $validator = new ComponentsValidator(new Set(array_merge(array('id' => '17', 'birthday' => '21.11.1984', 'name' => 'Scheit', 'firstName' => 'Philipp ', 'email' => '*****@*****.**', 'yearKnown' => 'true'), $data), $person->getSetMeta()), $formPanel->getEntityForm()->getComponents()); return $validator; }
/** * Erstellt einen ComponentsValidator anhand des EntityFormPanels * * Der FormPanel muss die Componenten schon erstellt haben sie werden mit getComponents() aus dem Formular genommen */ public function createComponentsValidator(FormData $requestData, EntityFormPanel $panel, DCPackage $dc, array $components = NULL) { $this->validationEntity = $entity = $panel->getEntityForm()->getEntity(); $components = isset($components) ? Code::castCollection($components) : $panel->getEntityForm()->getComponents(); return $this->componentsValidator = new ComponentsValidator($this->createFormDataSet($requestData, $panel, $entity), $components, $this->componentRuleMapper); }