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(),
);
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
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.