kspitfire / pgsql-doctrine-round-function
PostgreSQL ROUND() function for Doctrine ORM
Package info
github.com/kspitfire/pgsql-doctrine-round
Type:symfony-bundle
pkg:composer/kspitfire/pgsql-doctrine-round-function
1.3
2019-09-08 05:03 UTC
Requires
- doctrine/orm: >=2.2.0
This package is auto-updated.
Last update: 2026-03-08 19:40:02 UTC
README
ROUND() function implementation for Doctrine DQL
Installation
$ composer require kspitfire/pgsql-doctrine-round-function
Configuration
# app/config/config.yml doctrine: orm: # ... dql: numeric_functions: Round: Kspitfire\PgSqlRoundFunction\DQL\RandomFunction
Usage
$em = $this->get('doctrine.orm.default_entity_manager'); // with precision $resultWithPrecision = $em->getRepository(Entity::class) ->createQueryBuilder('e') ->select('ROUND(e.fieldName / 15, 2) as num') ->setMaxResults(1) ->getQuery() ->getSingleScalarResult(); // without precision $resultWithoutPrecision = $em->getRepository(Entity::class) ->createQueryBuilder('e') ->select('ROUND(e.fieldName / 15) as num') ->setMaxResults(1) ->getQuery() ->getSingleScalarResult();