PHP code example of elshafey / doctrine-window-functions

1. Go to this page and download the library: Download elshafey/doctrine-window-functions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elshafey / doctrine-window-functions example snippets


// configure the extension first
$entityManager->getConfiguration()->addCustomStringFunction(
    'WINDOW',
    \Elshafey\DoctrineExtensions\WindowFunctions\Query\Mysql\Window::class
);

// use your window function formula
$q=$entityManager->createQueryBuilder()
->select('p')
->addSelect('WINDOW(ROW_NUMBER()) OVER(PARTITION BY p.name) as rowNumber')
->from('\Entities\Product','p')->getQuery();