定制 alm/querymap 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

alm/querymap

Composer 安装命令:

composer require alm/querymap

包简介

Query mechanism for Doctrine inspired by Django's QuerySet

README 文档

README

Provides a simplified interface for building queries with Doctrine.

Sample usage

/** @var \QueryMap\Bundle\QueryMapBundle\Service\QueryMapFactoryService $qmFactory */
$qmFactory = $this->container->get('querymap.factory');

$qm = $qmFactory->create(Team::class, 't');

/** @var $query \Doctrine\ORM\QueryBuilder */
$query = $qm->query([
    'points__gt' => '6',
    'continent' => 'Europe'
]);

echo $query->getDQL();
//SELECT t FROM FootballBundle\Entity\Team t
//WHERE (t.points >= 6) AND (t.continent = 'Europe')

Installation

Edit your composer.json to include the package into your project, and run composer update alm/querymap

require {
    ...
    "alm/querymap": "v1.1.*"
    ...
}

To your $bundles array in AppKernel.php include the QueryMap bundle and provide to its constructor.

$bundles = [
    ...
    new QueryMap\Bundle\QueryMapBundle\QueryMapBundle($this),
    ...
]

Next, to your config.yml file you should specify paths for your mapping yml files - if you use this feature - as such:

query_map:
    paths:
        - '@FooBundle/Resources/querymap'
        - '@BarBundle/Resources/querymap'

For the entities you wish to filter using QueryMap, add the @QM\Map annotation in the Entity header.

use Doctrine\ORM\Mapping as ORM;
use QueryMap\Contrib\Annotation\DoctrineAnnotationMapping as QM;

/**
 * @ORM\Entity(repositoryClass=\MyBundle\Repository\TeamRepository)
 * ...
 * @QM\Map
 */

You will now be able to filter by all properties of that entity which are defined as @ORM\Column, @ORM\ManyToOne or @ORM\OneToOne.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固