private function doUpdate(Api $api) { $error_msg = null; $form = $this->createForm(AdminForm::API_UPDATE); try { $updateForm = $this->validateForm($form); $event = new ApiUpdateEvent($api, $updateForm->get('profile')->getData() ?: null); $this->dispatch(TheliaEvents::API_UPDATE, $event); $response = RedirectResponse::create(URL::getInstance()->absoluteUrl($this->getRoute('admin.configuration.api'))); } catch (FormValidationException $e) { $error_msg = $this->createStandardFormValidationErrorMessage($e); } catch (\Exception $e) { $error_msg = $e->getMessage(); } if (null !== $error_msg) { $this->setupFormErrorContext("foo", $error_msg, $form, $e); $response = $this->renderList($api->getId()); } return $response; }
/** * Exclude object from result * * @param ChildApi $api Object to remove from the list of results * * @return ChildApiQuery The current query, for fluid interface */ public function prune($api = null) { if ($api) { $this->addUsingAlias(ApiTableMap::ID, $api->getId(), Criteria::NOT_EQUAL); } return $this; }