PHP code example of ggergo / sqlindexhintbundle

1. Go to this page and download the library: Download ggergo/sqlindexhintbundle 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/ */

    

ggergo / sqlindexhintbundle example snippets


use Ggergo\SqlIndexHintBundle\SqlIndexWalker;
use Doctrine\ORM\Query;
// ...
$query = '...';
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlIndexWalker::class);
$query->setHint(SqlIndexWalker::HINT_INDEX, [
    'your_dql_table_alias'           => 'FORCE INDEX FOR JOIN (your_composite_index) FORCE INDEX FOR ORDER BY (PRIMARY)',
    'your_another_dql_table_alias'   => 'FORCE INDEX (PRIMARY)',
    // ...
]);