/** * Handle the command. * * @param Dispatcher $events */ public function handle(Dispatcher $events) { $this->builder->fire('posting', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_posting'); $this->dispatch(new LoadFormValues($this->builder)); /** * Multiple form builders do not get * validated here.. in fact: * * @todo: Decouple validation into it's own method like multiple form builders */ if (!$this->builder instanceof MultipleFormBuilder) { $this->dispatch(new ValidateForm($this->builder)); } $this->dispatch(new RemoveSkippedFields($this->builder)); $this->dispatch(new HandleForm($this->builder)); $this->dispatch(new SetSuccessMessage($this->builder)); $this->dispatch(new SetActionResponse($this->builder)); if ($this->builder->isAjax()) { $this->dispatch(new SetJsonResponse($this->builder)); } $this->builder->fire('posted', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_posted'); $events->fire(new FormWasPosted($this->builder)); }
/** * Handle the command. * * @param Dispatcher $events */ public function handle(Dispatcher $events) { $this->builder->fire('saving', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_saving'); $repository = $this->builder->getRepository(); $repository->save($this->builder); $this->builder->fire('saved', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_saved'); $events->fire(new FormWasSaved($this->builder)); }
/** * Handle the command. * * @param Dispatcher $events */ public function handle(Dispatcher $events) { // We can't save if there is no repository. if (!($repository = $this->builder->getRepository())) { return; } $this->builder->fire('saving', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_saving'); $repository->save($this->builder); $this->builder->fire('saved', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_saved'); $events->fire(new FormWasSaved($this->builder)); }
/** * Handle the command. * * @param Dispatcher $events */ public function handle(Dispatcher $events) { $this->builder->fire('posting', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_posting'); $this->dispatch(new LoadFormValues($this->builder)); $this->dispatch(new ValidateForm($this->builder)); $this->dispatch(new RemoveSkippedFields($this->builder)); $this->dispatch(new HandleForm($this->builder)); $this->dispatch(new SetSuccessMessage($this->builder)); $this->dispatch(new SetActionResponse($this->builder)); if ($this->builder->isAjax() && !$this->builder->getFormResponse()) { $this->dispatch(new SetJsonResponse($this->builder)); } $this->builder->fire('posted', ['builder' => $this->builder]); $this->builder->fireFieldEvents('form_posted'); $events->fire(new FormWasPosted($this->builder)); }