PHP code example of letkode / data-provider-bundle
1. Go to this page and download the library: Download letkode/data-provider-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/ */
use Letkode\DataProviderBundle\Attribute\DataProvider;
use Letkode\DataProviderBundle\Attribute\DataProviderMethod;
#[DataProvider(providerGroup: 'form-options', alias: 'countries')]
final class CountryRepository extends ServiceEntityRepository
{
#[DataProviderMethod(alias: 'active')]
public function findActiveAsOptions(): array
{
return $this->createQueryBuilder('c')
->select('c.uuid, c.code, c.name')
->where('c.active = true')
->getQuery()
->getArrayResult();
}
}
#[DataProvider(providerGroup: 'search', alias: 'countries')]
final class CountrySearchService
{
#[DataProviderMethod(alias: 'by-name')]
public function searchByName(): array { /* ... */ }
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.