kspitfire / pgsql-doctrine-round-function
PostgreSQL ROUND() function for Doctrine ORM
Installs: 4 446
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:symfony-bundle
Requires
- doctrine/orm: >=2.2.0
This package is auto-updated.
Last update: 2025-05-08 18:01:03 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();