for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Infrastructure\Services\SqliteForeignKeyEnabler;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events;
class SqliteForeignKeyEnabler implements EventSubscriberInterface
{
public function getSubscribedEvents(): array
return [Events::postConnect];
}
public function postConnect(ConnectionEventArgs $args): void
if (strtolower($args->getConnection()->getDatabasePlatform()->getName()) !== 'sqlite') {
return;
$args->getConnection()->exec('PRAGMA foreign_keys = ON;');
Doctrine\DBAL\Connection::exec()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
/** @scrutinizer ignore-deprecated */ $args->getConnection()->exec('PRAGMA foreign_keys = ON;');
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.