tangoman/dql-helper-bundle

此包最新版本(1.0.0)没有提供许可证信息。

Symfony DQL Helper Bundle

安装: 8

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.0.0 2017-09-26 14:12 UTC

This package is auto-updated.

Last update: 2024-09-16 23:39:41 UTC


README

TangoMan DQL Helper Bundle 提供了一种简单的方法来为您的页面添加前端元素。使用 TangoMan DQL Helper Bundle 可以轻松构建您的应用的后台。

安装

步骤 1:下载 Bundle

打开命令行,进入您的项目目录,并执行以下命令以下载此 Bundle 的最新稳定版本:

$ composer require tangoman/dql-helper-bundle

此命令需要您全局安装了 Composer,具体请参考 Composer 文档的安装章节

步骤 2:启用 Bundle

然后,通过将其添加到项目 app/AppKernel.php 文件中注册的 Bundle 列表来启用此 Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new TangoMan\DqlHelperBundle\TangoManDqlHelperBundle(),
        );

        // ...
    }
}

使用方法

在您的仓库内

    /**
     * @param integer $fromLat
     * @param integer $fromLon
     *
     * @return mixed
     */
    public function getPlaces($fromLat, $fromLon)
    {
        $dql = $this->createQueryBuilder('places');
        $dql->select('places', 'p')
            ->where('DISTANCE(:fromLat, :fromLon, p.Lat, p.Lon') < 100')
            ->setParameter(':fromLat', $fromLat)
            ->setParameter(':fromLon', $fromLon)
        ;

        return $dql->getQuery()->getResult();
    }

注意

如果您发现任何错误,请在此处报告:问题

许可证

版权所有(c)2017 Matthias Morin

License 在 MIT 许可证下分发。

如果您喜欢 TangoMan DQL Helper Bundle 请给它加星!并在 GitHub 上关注我: TangoMan75 ... 并查看我的其他项目。

tangoman.free.fr