glavweb / datagrid-bundle
本包的最新版本(v3.1.1)没有提供许可证信息。
GLAVWEB DatagridBundle
v3.1.1
2023-06-28 08:36 UTC
Requires
- php: >=7.2.5
- ext-json: *
- doctrine/doctrine-bundle: ^2.0
- doctrine/orm: ^2.3
- glavweb/data-schema-bundle: ^2.0
- symfony/config: ^4.0|^5.0|^6.0
- symfony/dependency-injection: ^4.0|^5.0|^6.0
- symfony/yaml: ^4.0|^5.0|^6.0
Requires (Dev)
- phpunit/phpunit: ^6.4
- symfony/phpunit-bridge: ^3.3
- dev-master
- v3.1.1
- v3.1.0
- v3.0.0
- v2.4.0
- v2.3.0
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.11.1
- v1.11.0
- 1.10.x-dev
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.1
- v1.8
- v1.7
- v1.6
- v1.5.2
- v1.5.1
- v1.5
- v1.4
- v1.3
- v1.2
- v1.1.2
- v1.1.1
- v1.1
- 1.0
- 0.2
- 0.1.x-dev
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
This package is auto-updated.
Last update: 2024-08-28 11:11:44 UTC
README
使用composer获取此扩展包
通过在您的Symfony项目的根目录终端运行此命令来添加GlavwebDatagridBundle
php composer.phar require glavweb/datagrid-bundle
启用扩展包
要开始使用扩展包,请在您的应用程序的kernel类中注册扩展包
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Glavweb\DatagridBundle\GlavwebDatagridBundle(), // ... ); }
配置扩展包
本扩展包旨在直接使用。为了使此扩展包正常运行,您只需配置映射即可。
基本用法
定义数据架构
# app/config/data_schema/article.schema.yml
schema:
class: AppBundle\Entity\Article
properties:
id:
name:
slug:
body:
定义范围
# app/config/scopes/article/short.yml
scope:
name:
在控制器中使用
$datagridBuilder = $this->get('glavweb_datagrid.doctrine_datagrid_builder')
->setEntityClassName('AppBundle\Entity\Article')
->setAlias('t')
->setDataSchema('article.schema.yml', 'article/short.yml')
->setFirstResult(0)
->setMaxResults(2)
->setOrderings(['name' => 'ASC'])
;
// Define filters
$datagridBuilder
->addFilter('name')
;
$datagrid = $this->datagridBuilder->build(['name' => 'Article 1']);
$list = $datagrid->getList();