qbbr / pgsql-doctrine-random-function
PostgreSQL RANDOM() function for Doctrine ORM
Installs: 97 591
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 2
Type:symfony-bundle
Requires
- doctrine/orm: >=2.2.0
This package is auto-updated.
Last update: 2025-02-14 17:51:07 UTC
README
PostgreSQL RANDOM() function for Doctrine ORM
Installation
Step 1: Download the package
$ composer require qbbr/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();