PHP code example of biig / dictionary-bundle

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

    

biig / dictionary-bundle example snippets


$bundles = array(
    // ...
    new Knp\DictionaryBundle\KnpDictionaryBundle(),
);

$container->get('knp_dictionary.registry')->get('my_dictionary');

use Knp\DictionaryBundle\Form\Type\DictionaryType;

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('civility', DictionaryType::class, [
            'name' => 'my_dictionary'
        ])
    ;
}

use Knp\DictionaryBundle\Validator\Constraints\Dictionary;

class User
{
    /**
     * @ORM\Column
     * @Dictionary(name="my_dictionary", multiple=false)
     */
    private $civility;
}

// Retrieve all dictionaries of a special category
$dictionaries = $registry->filterByCategory('product.toy')->all();
bash
php bin/console knp:dictionary:dump