Caelrik\Ui\Adapters\Symfony
CaelrikTwigExtension
final class Caelrik\Ui\Adapters\Symfony\CaelrikTwigExtension extends AbstractExtension
{{ caelrik_assets() }} or {{ caelrik_assets(customTheme: '/css/acme.css') }} — load jQuery and Bootstrap before it. {{ caelrik(grid) }} — renders any Caelrik component.
Methods
__construct
__construct(string $assetsBaseUrl = '/bundles/caelrik')getFunctions
getFunctions(): arrayrender
render(Component $component): stringassets
assets(?string $baseUrl = null, ?string $nonce = null, string $theme = 'bootstrap', ?string $customTheme = null): stringCaelrikUiBundle
final class Caelrik\Ui\Adapters\Symfony\CaelrikUiBundle extends AbstractBundle
Register in config/bundles.php:
Caelrik\Ui\Adapters\Symfony\CaelrikUiBundle::class => ['all' => true],Twig: {{ caelrik_assets() }} and {{ caelrik(grid) }} Assets: php bin/console assets:install (copies public/ to public/bundles/caelrik)
Methods
getPath
getPath(): stringThe package root, so that assets:install finds the prebuilt public/ directory.
loadExtension
loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): voidDoctrineDataSource
final class Caelrik\Ui\Adapters\Symfony\DoctrineDataSource implements DataSourceInterface
Data source for a Doctrine ORM query builder, e.g. new DoctrineDataSource($repository->createQueryBuilder('u')->select('u.id, u.name, u.email')).
Plain fields resolve against the root alias (name => u.name); dotted fields are used as-is (a.name). For joined columns shown in a Grid, select them under an alias and map that alias to its DQL path, so the same field name sorts, searches and appears in the rows:
$qb->select('b.id, b.title, a.name AS author')->join('b.author', 'a');
new DoctrineDataSource($qb, fieldMap: ['author' => 'a.name']);Select scalar fields rather than whole entities: rows are returned with getArrayResult().
Methods
__construct
__construct(QueryBuilder $queryBuilder, array $searchable = [], array $fieldMap = [])$searchable: Search fields used when the request does not specify any.
fetch
fetch(DataRequest $request): DataResultDoctrineEventSource
final class Caelrik\Ui\Adapters\Symfony\DoctrineEventSource implements EventSourceInterface
Event source for a Doctrine ORM query builder, e.g. new DoctrineEventSource($repository->createQueryBuilder('m'), ['start' => 'startsAt', 'end' => 'endsAt']).
Field values are entity property names on the root alias. Only rows overlapping the requested range are queried; rows are read with getArrayResult().
Methods
__construct
__construct(QueryBuilder $queryBuilder, array $fields = [])between
between(DateRange $range): iterable