sergeil/doctrine-array-query-builder-bundle
Composer 安装命令:
composer require sergeil/doctrine-array-query-builder-bundle
包简介
Provides an alternative way to build query using standard PHP's array notation
README 文档
README
With this bundle on board you will be able to build complex DQL queries using a simple PHP associative arrays notation, this way simplicity of writing queries goes on a whole new level, analytical applications which must allow to build queries from UI will especially benefit from this bundle (bundle out of the box supports client/server communication protocol used by ExtJs framework, in other words).
Teaser
Say that we have a classical User and Group entities associated as ManyToMany and that User entity have OneToOne association with Profile entity, this is how a sample query could look like:
$query = array( 'filter' => [ // if the property is OneToMany relation and IN query is used the MEMBER OF query will be built automatically array('property' => 'groups', 'value' => 'in:1,2,3'), array('property' => 'username', 'value' => 'like:John%'), // this will automatically build proper JOINS under the hood array('property' => 'profile.insurance.securityNumber', 'value' => 'isNull') ], 'fetch' => [ // this will inform array query builder that you want to have associated Profile and then Insurance entities // to be fetched as well 'profile.insurance' ], 'sort' => [ array('property' => 'id', 'direction' => 'DESC') ], 'page' => 1, 'limit' => 25 ); /* @var \Sli\DoctrineArrayQueryBuilderBundle\Querying\ArrayQueryBuilder $aqb */ $aqb = $container->get('sli_doctrine_array_query_builder.querying.array_query_builder'); // Only those users will be returned: // 1. belong to groups with IDS 1, 2 and 3 // 2. whose `username`s contain John // 3. whose associated Insurance entity's securityNumber is NULL // Result will be ordered by ID field and paginated $users = $aqb->buildQuery('MyCompany\MyBundle\Entity\User', $query);
For all supported functionality please see a functional test located in
Tests/Functional/Querying/ArrayQueryBuilderTest.php.
Supported filtering operators:
- eq
- neq
- like
- notLike
- gt
- gte
- lt
- lte
- in
- notIn
- isNull
- isNotNull
Installation
Add this dependency to your composer.json:
"sergeil/doctrine-array-query-builder-bundle": "dev-develop"
Update your AppKernel class and add this:
new \Sli\DoctrineArrayQueryBuilderBundle\SliDoctrineArrayQueryBuilderBundle(),
Licensing
This bundle is under the MIT license. See the complete license in the bundle: Resources/meta/LICENSE
sergeil/doctrine-array-query-builder-bundle 适用场景与选型建议
sergeil/doctrine-array-query-builder-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 01 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「doctrine」 「extjs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sergeil/doctrine-array-query-builder-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sergeil/doctrine-array-query-builder-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sergeil/doctrine-array-query-builder-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Utilities for easier integration of ExtJs on server-side.
Ext-JS / Sencha Touch RPC Intergration Module for Zend Framework 2
Make pimcore migration simple
Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction
PHP/ExtJS-based web development platform
MySQL Workbench Schema Exporter for Sencha ExtJS3 and ExtJS4
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-10