public function saveEntryAttributesForm(Form $form, Entry $entry) { foreach ($form->getControls() as $control) { $type = $control->getControlType(); $saver = $type->getSaveHandler($control); if ($saver instanceof SaveHandlerInterface) { $saver->saveFromRequest($control, $entry, $this->request); } } $this->entityManager->flush(); $ev = new Event($entry); $ev->setEntityManager($this->entityManager); \Events::dispatch('on_express_entry_saved', $ev); return $ev->getEntry(); }
public function validate(Form $form) { $token = \Core::make('token'); if (!$token->validate('express_form', $this->request->request->get('ccm_token'))) { $this->error->add($token->getErrorMessage()); } foreach ($form->getControls() as $control) { $type = $control->getControlType(); $validator = $type->getValidator($control); if (is_object($validator)) { $e = $validator->validateRequest($control, $this->request); if (is_object($e) && $e->has()) { $this->error->add($e); } } } return $this->error; }