PHP code example of kunicmarko / form-annotation-bundle

1. Go to this page and download the library: Download kunicmarko/form-annotation-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kunicmarko / form-annotation-bundle example snippets


$bundles = array(
    // ...
    new KunicMarko\FormAnnotationBundle\FormAnnotationBundle(),
);

public function createAction(Request $request, UserService $userService)
{
    $form = $this->createForm(CreateUserType::class, $user = new User());

    $form->submit($request->request->all());

    if ($form->isValid()) {
        $userService->createUser($user);

        return View::create($user, Response::HTTP_CREATED);
    }

    return View::create($form);
}