Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (34 sloc) 908 Bytes
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Doctrine;
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events;
class SqliteSessionInitSubscriber implements EventSubscriber
{
/**
* {@inheritdoc}
*/
public function getSubscribedEvents()
{
return [
Events::postConnect,
];
}
/**
* @param ConnectionEventArgs $args
* @throws \Doctrine\DBAL\DBALException
*/
public function postConnect(ConnectionEventArgs $args)
{
if ('sqlite' !== strtolower($args->getDatabasePlatform()->getName())) {
return;
}
$args->getConnection()->executeUpdate('PRAGMA foreign_keys = ON;');
}
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.