aldaflux / pgsql-doctrine-random-function
PostgreSQL RANDOM() function for Doctrine ORM, fork from https://packagist.org/packages/qbbr/pgsql-doctrine-random-function
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Type:symfony-bundle
Requires
- doctrine/orm: >=2.2.0
This package is auto-updated.
Last update: 2024-12-16 17:34:18 UTC
README
PostgreSQL RANDOM() function for Doctrine ORM
Installation
Step 1: Download the package
$ composer require aldaflux/pgsql-doctrine-random-function
Step 2: Configuration
# app/config/config.yml doctrine: orm: # ... dql: numeric_functions: Random: Qbbr\PgsqlDoctrineRandomFunction\DQL\RandomFunction
Usage
$em = $this->getDoctrine()->getManager(); $result = $em->createQueryBuilder() ->select('e') ->from('AppBundle:Entity', 'e') ->orderBy('RANDOM()') ->setMaxResults(10) ->getQuery() ->getResult();