PHP code example of php-programmist / file-sql-logger-bundle
1. Go to this page and download the library: Download php-programmist/file-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/ */
php-programmist / file-sql-logger-bundle example snippets
composer
//src/Controller/SomeController.php
namespace App\Controller;
use PhpProgrammist\FileSqlLoggerBundle\FileSqlLogger;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class SomeController extends AbstractController
{
public function index(FileSqlLogger $sql_logger)
{
$connection = $this->getDoctrine()->getConnection();
$connection->getConfiguration()->setSQLLogger($sql_logger);
$em = $this->getDoctrine()->getManager();
//make queries for some entities and change it
$em->flush();
...
}
}