Skip to content

Celerik\Ui\Adapters\Symfony ​

CelerikTwigExtension ​

final class Celerik\Ui\Adapters\Symfony\CelerikTwigExtension extends AbstractExtension

{{ celerik_assets() }} or {{ celerik_assets(theme: 'material', customTheme: '/css/acme.css') }} — load jQuery and Bootstrap before it. {{ celerik(grid) }} — renders any Celerik component.

Methods ​

__construct ​

php
__construct(string $assetsBaseUrl = '/bundles/celerikui')

getFunctions ​

php
getFunctions(): array

render ​

php
render(Component $component): string

assets ​

php
assets(?string $baseUrl = null, ?string $nonce = null, string $theme = 'bootstrap', ?string $customTheme = null): string

CelerikUiBundle ​

final class Celerik\Ui\Adapters\Symfony\CelerikUiBundle extends AbstractBundle

Register in config/bundles.php:

php
Celerik\Ui\Adapters\Symfony\CelerikUiBundle::class => ['all' => true],

Twig: {{ celerik_assets() }} and {{ celerik(grid) }} Assets: php bin/console assets:install (copies public/ to public/bundles/celerikui)

Methods ​

getPath ​

php
getPath(): string

The package root, so that assets:install finds the prebuilt public/ directory.

loadExtension ​

php
loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void

DoctrineDataSource ​

final class Celerik\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:

php
$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 ​

php
__construct(QueryBuilder $queryBuilder, array $searchable = [], array $fieldMap = [])
  • $searchable: Search fields used when the request does not specify any.

fetch ​

php
fetch(DataRequest $request): DataResult

DoctrineEventSource ​

final class Celerik\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 ​

php
__construct(QueryBuilder $queryBuilder, array $fields = [])

between ​

php
between(DateRange $range): iterable

Released under the MIT License.