PHP code example of halloverden / symfony-doctrine-sql-logger-bundle

1. Go to this page and download the library: Download halloverden/symfony-doctrine-sql-logger-bundle 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/ */

    

halloverden / symfony-doctrine-sql-logger-bundle example snippets


// config/bundles.php

return [
    // ...
    HalloVerden\DoctrineSqlLoggerBundle\HalloVerdenDoctrineSqlLoggerBundle::class => ['all' => true],
];

readonly class MyRepository {
    public function __construct(
        private QueryExecutionTimeLoggerInterface $queryExecutionTimeLogger
    ) {
    }
    
    public function executeQuery(): User {
        $this->queryExecutionTimeLogger->addContext(new QueryExecutionTimeContext(threshold: 500));
        // ... Execute query
    }
}