<?php
/**
 * @license MIT
 *
 * Modified by RTM Business on 16-December-2024 using {@see https://github.com/BrianHenryIE/strauss}.
 */

namespace RtmMailVendor\Dependencies\Doctrine\DBAL\Event\Listeners;

use RtmMailVendor\Dependencies\Doctrine\Common\EventSubscriber;
use RtmMailVendor\Dependencies\Doctrine\DBAL\Event\ConnectionEventArgs;
use RtmMailVendor\Dependencies\Doctrine\DBAL\Events;
use RtmMailVendor\Dependencies\Doctrine\DBAL\Exception;

/** @deprecated Use {@see \Doctrine\DBAL\Driver\AbstractSQLiteDriver\Middleware\EnableForeignKeys} instead. */
class SQLiteSessionInit implements EventSubscriber
{
    /**
     * @return void
     *
     * @throws Exception
     */
    public function postConnect(ConnectionEventArgs $args)
    {
        $args->getConnection()->executeStatement('PRAGMA foreign_keys=ON');
    }

    /**
     * {@inheritDoc}
     */
    public function getSubscribedEvents()
    {
        return [Events::postConnect];
    }
}
