sergeil/doctrine-array-query-builder-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固