https://github.com/qbbr/pgsqldoctrinerandomfunction
PostgreSQL RANDOM() function for Doctrine ORM
https://github.com/qbbr/pgsqldoctrinerandomfunction
doctrine-orm php postgresql symfony
Last synced: 21 days ago
JSON representation
PostgreSQL RANDOM() function for Doctrine ORM
- Host: GitHub
- URL: https://github.com/qbbr/pgsqldoctrinerandomfunction
- Owner: qbbr
- License: mit
- Created: 2016-03-11T06:28:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-16T16:45:29.000Z (11 months ago)
- Last Synced: 2025-06-05T10:49:03.663Z (about 1 month ago)
- Topics: doctrine-orm, php, postgresql, symfony
- Language: PHP
- Size: 3.91 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PgsqlDoctrineRandomFunction
PostgreSQL RANDOM() function for Doctrine ORM
[](https://packagist.org/packages/qbbr/pgsql-doctrine-random-function)
[](https://packagist.org/packages/qbbr/pgsql-doctrine-random-function)
[](https://packagist.org/packages/qbbr/pgsql-doctrine-random-function)## Installation
### Step 1: Download the package
```bash
$ composer require qbbr/pgsql-doctrine-random-function
```### Step 2: Configuration
```yaml
# app/config/config.ymldoctrine:
orm:
# ...
dql:
numeric_functions:
Random: Qbbr\PgsqlDoctrineRandomFunction\DQL\RandomFunction
```## Usage
```php
$em = $this->getDoctrine()->getManager();$result = $em->createQueryBuilder()
->select('e')
->from('AppBundle:Entity', 'e')
->orderBy('RANDOM()')
->setMaxResults(10)
->getQuery()
->getResult();
```