PHP code example of evolutto / gregwar-form

1. Go to this page and download the library: Download evolutto/gregwar-form 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/ */

    

evolutto / gregwar-form example snippets



// app/AppKernel.php
//...
public function registerBundles()
{
    $bundles = array(
        ...
        new Gregwar\FormBundle\GregwarFormBundle(),
        ...
    );
...


//...
$builder
    ->add('city', 'entity_id', array(
        'class' => 'Project\Entity\City',
        'query_builder' => function(EntityRepository $repo, $id) {
            return $repo->createQueryBuilder('c')
                ->where('c.id = :id AND c.available = 1')
                ->setParameter('id', $id);
        }
    ))
    ;


//...
$builder
    ->add('city', 'entity_id', array(
        'class' => 'Project\Entity\City',
        'hidden' => false,
        'label' => 'Enter the City id'
    ))
    ;


//...
$builder
    ->add('recipient', 'entity_id', array(
        'class' => 'Project\Entity\User',
        'hidden' => false,
        'property' => 'login',
        'label' => 'Recipient login'
    ))
    ;