Giter Site home page Giter Site logo

formhandler's Introduction

FormHandler

Build Status

This is a Form Handler implementation which I used in combination with the Symfony Form component.

Click here to go to the blog post I wrote about the form handler.

Usage

Implement the FormHandlerInterface OR extend the AbstractFormHandler and implement the postProcess method.

You can use a try/catch to catch validation exceptions.

Example:

public function anActionInAController(Request $request)
{
    $formHandler = new MyFancyFormHandler($formFactory, $form);

    $form = $formHandler->form();

    if ($request->isMethod('POST') {
        try {
            $formHandler->process($form, $request);
        } catch (ValidationException $e) {
            // Do something with the validation... or not ;-) (and render the page including the validation errors)
        }
    }

    return $this->render('my_view.html.twig', ['form' => $form->createView()]);
}

formhandler's People

Contributors

dennisdegreef avatar piwi91 avatar

Watchers

 avatar  avatar

Forkers

dennisdegreef

formhandler's Issues

Release stable version

To release a stable version, please use git tag and push it to github

  • Please choose a stable revision and navigate to there (if it's not HEAD)
    git checkout $revision
  • Tag the revision with a version number and annotation
    git tag -a v1.0.0 -m 'Release v1.0.0'
  • Push the tag to github to finalize it (if upstream is your remote, else use something like origin)
    git push upstream v1.0.0
  • Go to packagist.org, log in, and press 'update'.

Composer should now be aware of a stable 1.0.0 release.

  • ...
  • Profit

Fix 5.4 compatibility

The ::class should be removed and instead the class name as a string should be used to check the instance of an object.

Implement Test Suite

It would be nice for a test suite to automatically test changes and report on breaking issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.