PHP code example of letkode / form-options-bundle

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

    

letkode / form-options-bundle example snippets


// config/bundles.php
return [
    Letkode\FormOptionsBundle\LetkodeFormOptionsBundle::class => ['all' => true],
];

use Letkode\FormOptionsBundle\Attribute\FormOption;
use Letkode\FormOptionsBundle\Attribute\FormOptionMethod;

#[FormOption(alias: 'countries')]
final class CountryRepository extends ServiceEntityRepository
{
    #[FormOptionMethod(alias: 'active')]
    public function findActiveAsOptions(): array
    {
        return $this->createQueryBuilder('c')
            ->select('c.uuid, c.code, c.name')
            ->where('c.active = true')
            ->getQuery()
            ->getArrayResult();
    }
}